Bill
Bill

Reputation: 384

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."

Upvotes: 3

Views: 1246

Answers (2)

Bill
Bill

Reputation: 384

I ended up decoding the image and writing it to a temporary directory.

Upvotes: 1

tehknox
tehknox

Reputation: 278

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.

Upvotes: 1

Related Questions