Have your admin put this on his page with the name of your php file and the path to your image:
Code:
<img src="atest3.php?img=../images/105_0532.jpg" />
Then try this:
PHP Code:
$fname = $_GET['img'];
$copy = imagecreatefromjpeg($fname);
$oldWidth = imagesx($copy);
$oldHeight = imagesy($copy);
$max = 300;
if($oldWidth > $oldHeight)
{
$newWidth = 300; //If oldWidth was 600, then newWidth
//is 300/600 smaller and that fraction needs to be
//multiplied by the oldHeight to get the new height
$newHeight = (300/$oldWidth) * $oldHeight;
}
else
{
$newHeight = 300;
$newWidth = (300/$oldHeight) * $oldWidth;
}
$newImg = imagecreatetruecolor($newWidth, $newHeight);
imagecopyresampled($newImg, $copy, 0,0,0,0, $newWidth, $newHeight, $oldWidth, $oldHeight);
header('Content-Type: image/jpeg');
imagejpeg($newImg);
imagedestroy($copy);
imagedestroy($newImg);
Edit:
Added two lines at the end.
Bookmarks