Hello I'm wondering is this possible with php and if so how could it be done.
I get a list of images from a supplier. They come like this
http://example.com/dev/4/3/04050834/t_04050534.jpg http://example.com/dev/4/3/04050834/t_04050834.jpg http://example.com/dev/4/3/04050834/t_04050834.jpg http://example.com/dev/4/3/04050834/t_04050834.jpg http://example.com/dev/4/3/04050834/t_04055834.jpg http://example.com/dev/4/3/04050834/t_04050364.jpg http://example.com/dev/4/3/04050834/t_04050567.jpg
these are all thumbs
they have the same links for large images but rather than the t at the start of the image name, the large images have l
But not all the images have large versions of them
so would it be possible using php that if the large version of the image doesn't exist it would display the small version of it? And to do that autmatically?
if (file_exists('l_...')) echo '<img src="l_..." alt=""/>'; else echo '<img src="t_..." alt=""/>';
Thanks.
One other thing. Would this be possible.
I would like to be able to display an image as for example /image.php?file=1.jpg
would it be possbile to display a file from another server as that on my server.
so if for instance the file on the other server was http://example1.com/1/2/3/4.jpg
would it be possible to have a script on my server like.
http://myserver.com/image.php?file=1/2/3/4.jpg
If so what would the php need to be in that php file?
if that is a link you can insert into your html like the original method:
<img src="urlhere" alt="xxx" />
Thanks but I don't think I explained what I want to do very well.
I bascially want to hide the url of an image using php. But the image is not on my server it is on a different one (my suppliers)
so ideally rather than http://mysupplier.com/image.jpg as my image url I would like http://myserver.com/image.php?file=image.jpg
I'm wondering is this possible and if so what code would be in the image.php file?
$url = 'http://example.com/'; if (file_exists($url . 'l_...')) echo '<img src="'. $url . 'l_..." alt=""/>'; else echo '<img src="' . $url . 't_..." alt=""/>';
Lets use a .php file to redirect the query,
and embed with this .php file:
<a href="image.php?q=1.jpg">
and in php file use the readfile for the remote host: see: readfile() on php.net.