Png Images uploaded using api wont preview, only downloads to client



When using the php libraryOfficial

When using the php client library, my pngs files are uploaded via createOnTask(). However, there is no preview and I cannot view the file in the browser. Instead it downloads the image. THis is not a browser issue as other images uploaded in asana work as expected.

I don’t know how to implement the content-type properly I think… I thought I was to specify “image/png”, but that did not work. Again, I can download it from the task after uploading via api, but I cannot preview and it does not show up on task card when it’s the first image.


Hey @Brian_Clinton,

I’m sharing some code that is working and maybe can help you. Ignore the resizing part.

 $filename = basename($data['photo']);
 $path = public_path('photo_tmp') . '/'. $filename;
 $type = finfo_file(finfo_open(FILEINFO_MIME_TYPE), $path);
 $image = \Image::make($path)->resize(150, 150)->save($path)->destroy();



Yeah, it is sooo straightforward. I got it working the same way. But, during initial testing, it didn’t seem to accept the “image/png” content-type… So, I looked at forums and tried the multipart form method with the php library. It did not seem to support the $request[‘headers’] options array, so, I went back to original parameters and it works fine.

The thing that got me weirded out at first was that it actually uploaded the file and you could download it from asana task and view, but the browser wouldn’t preview it and the thumb-nailing process wouldn’t happen, which made me thing content-type was culprit. Anyways, working fine. Thanks for the fast response!