Pergunta

This is an odd question but I'm stuck on how I would achieve this and I am unable to find any methods of doing so.

I have a simple php script that takes variables (containing file names) from the URL, cleans then and then uses them to generate a single image from the inputted values. This works fine and outputs a new png to the webpage using:

imagepng($img);

I also have a facebook sharing script in PHP that takes a filepath as an input and then shares the image on the users feed where this statement is used to define the image variable:

$photo = './mypic.png'; // Path to the photo on the local filesystem

I don't know how I can link these two together though. I would like to use my generation script as the image to share.

Can anyone point me in the right direction of how to do this? I am not the master of PHP so go easy please.

-Tim

UPDATE

If it helps, here are the links to the two pages on my website containing the outputs. They are very ruff mind you:

The php script generating the image: http://the8bitman.herobo.com/Download/download.php?face=a.png&color=b.png&hat=c.png

The html page with the img tag: http://the8bitman.herobo.com/Share.html

Foi útil?

Solução

Treat it as a simple image:

<img src="http://yourserve/yourscript.php?onlyImage=1" />

yourscript.php

if($_GET['onlyimage']) {
 header('Content-type:image/png'); //or your image content type
 //print only image
} else {
 //print image and text too
}
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top