Greetings.

I've been working on a function to generate QR codes based on a text field input on a form. I've been able to get the script to dynamically-generate the image and display it on the page...

<img src="/includes/whatever.php?var1=http://www.google.com&var2=bar" />

However: what I now need to do is take that php-generated data (displayed as an image via setting headers in the script above) and output it to either a JPEG or PNG file (doesn't matter which) for the user to save on their computer (ie, a Save As dialog pops up).

I've tried the ImagePng($image) mode...no luck.

I've tried ob_start(); and getting the 'file' contents...no luck.

Does anyone know how to either capture the output from the script (not shown here) and write it to an image file?

(I can post my code if needed, but didn't think it'd help much in this instance)

Thanks!

:::a

    You can use imagecreatefromjpeg() to get the image & save it.

    Using the sample function (with some small modifications) from that page, you can change the imagejpeg() function to SAVE a file.

    the imagecreatefromjpeg allows a URL as a source (which you can use)

    Best of luck

      Write a Reply...