Jump to content

Using File Put contents with BLOB Image data


DrTrans

Recommended Posts

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.