2

I'm trying to make a base64 image available for open graph og:image so it can be properly recognized by facebook, and I did what described in this post

So this is my code:

<?php echo '<img src="decoder.php?Data='.$base64.'">'; ?>

and this is decoder.php:

echo base64_decode($_GET['Data']);

But I have the following error: 414 (Request-URI Too Large)

How can I do?

EDIT: for example I thought to create a temp image in decoder.php then redirect to this image, and then delete it after 10 minutes... But I don't know how to do it.. and if it is a good idea..

Community
  • 1
  • 1
neoDev
  • 2,879
  • 3
  • 33
  • 66
  • Are you getting `$base64` from ajax call ? – Sulthan Allaudeen May 31 '15 at 03:37
  • @SulthanAllaudeen I'm getting `$base64` from a json by file_get_contents – neoDev May 31 '15 at 03:40
  • You're trying 2 things at the same time i.e., requesting the image, printing it.. If the image is somewat large then it'l show the error you stated... But your file needs to wait untill the image reaches you (completely). So you should do like this.. You should put an ajax call and wait for the reply and on success you should print your image.. You want me to help on implementing the ajax call ? – Sulthan Allaudeen May 31 '15 at 03:44
  • Been trying to solve this for the whole day – Sboniso Marcus Nzimande Aug 18 '15 at 13:44

1 Answers1

3

Make sure u add the 'data:image/png;base64,' string before echoing the image data