DrTrans Posted June 17, 2014 Share Posted June 17, 2014 I have a base64 encoded image -> http://pastebin.com/698ES5t0 Im trying to export this as a png file. $picture = {data on paste bin}; $picture = base64_decode($picture); file_put_contents('/home/picture.png', $Picture); Now this creates a file picture.png and i can open it in Preview/Gimp etc. However, if i upload the file to my website, the image does not render in chrome/firefox, however it does render in Safarai. It seems that there is no height/width/depth data. Link to comment https://forums.phpfreaks.com/topic/289186-using-file-put-contents-with-blob-image-data/ Share on other sites More sharing options...
requinix Posted June 17, 2014 Share Posted June 17, 2014 That's a JPEG 2000 image, not PNG. You can't just name a file what you want and expect it to work. With that said, renaming with the appropriate extension (a) isn't enough because there's more to the issue than just the extension and (b) really isn't enough because it's JPEG 2000 and that format isn't commonly supported. Convert it to a different format. Link to comment https://forums.phpfreaks.com/topic/289186-using-file-put-contents-with-blob-image-data/#findComment-1482794 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.