I’ve tested the following and it behaves the same as attaching an image to a task’s description/notes in the UI. The img tag should include the following (replacing the {} placeholders with your own values).
Looking at your source, it doesn’t appear that you are setting the src property of the <img>. You will want to set the src to the attachment’s view_url property. In your code, it might like something like:
Our current implementation cannot use the fix src="' . $attachment->view_url . '" because our attachment object does not have view_url. We need your support in this matter to understand possible solutions for this.
Problem with the Asana library version:
We are using the Asana (GitHub - Asana/php-asana: Official PHP client library for the Asana API v1) library version 0.10.8 for integration, and it works correctly. However, when we update it to version 1.0.6, issues arise with creating attachments for tasks.
The release notes on GitHub (Releases · Asana/php-asana · GitHub) indicate that in version 1.0.0, the creation of attachments for tasks was removed. Could you please what to use instead of it or how we can do inline insert writing on a new version of the library?
so there is no method createAttachmentForTask
We can stay on version 0.10.8, but we need to know if there is a way to correctly display the picture inline in the task description.
Make sure the tag in your HTML for Asana includes a width attribute (e.g., ) to ensure the image displays correctly. Adjust the width value as necessary to ensure visibility within Asana.
Just ran into this and debugged the issue - apparently when the Asana API receives an image upload, it does some post processing on the image where it determines the width and height of the image you uploaded. Before this post processing completes, the width and height are set to 0. If you add a 1 second delay between uploading your image and updating your task description it should work correctly.