Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Saving base64 encoded image for facebook sharing via PHP

I have an image thumbnail, encoded as base64, that I want to use as the default thumbnail when sharing a page via Facebook. Facebook does not seem to support using the base64 image directly so I need to render/save/decode(?) it first before the user can click the "share" button. Any thoughts?

Here's my thumbnail:

$thumbnail = '<img src="data:image/jpg;base64,' . $thumbnail_src . '" />';

Obviously it renders fine in the browser but Facebook can't "get it."

like image 555
Bill Avatar asked Dec 06 '25 03:12

Bill


1 Answers

Try looking at the GD Library first. And then create a php page that will render the image with the correct header so Facebook will see this as an image.

like image 89
tehknox Avatar answered Dec 08 '25 16:12

tehknox