0

im having a problem in resizing an image on the Fly and i just need to know is there anything wrong with that line

<img src="image_resize.php?image=<?=$arr?>&max_width=200&max_height=120">

3
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by R0bb0b
0

hello,,
In img tag, the src is to have an image source like mylogo.gif etc...you can't pass an php page name..if you want to make that image clickable then,put it in to anchor tag or put onClick method on that image tag....
or
write your line like this way:

<a href="image_resize.php?image=<?=$arr['picture']?>&max_width=200&max_height=120"><img src="<?=$arr['picture']?>" width="200" height="120"> </a>

check it all.
thank you...

0

That depends on what you are doing though. You can make the src = a php file if on that file you are sending the image to the browser kind of like this.

<?
$imagedata = file_get_contents("temp/" . $randstring . ".jpg");
header('Content-type: image/jpg');
echo $imagedata;
exit();
?>

If you are doing something like that, then this should work. On this page I pull the file from a postgres database and save it to a temporary location for processing. Read the data with file_get_contents and send it to the browser with the header "Content-type: image/jpg". the browser will read it just like any other image.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.