http://bevrob6.100webspace.net/rlnz/view.php?folder=HKG&pname=228.jpg°rees=180&size=M
<?php
$filename = "http://www.mysite.com/travel/$folder/$pname";
$off_site = $filename;
$fp = fopen ($off_site, 'rb') or die('Unable to open file '.$off_site.' for reading');
$buf = '';
while (!feof ($fp))
{
$buf .= fgets($fp, 4096);
}
header('Content-Type: image/jpeg');
$data = $buf;
$src = imagecreatefromstring ($data);
$width = imagesx($src);
$height = imagesy($src);
$aspect_ratio = $height/$width;
$aspect_ratio2 = $width/$height;
if ($size == "M") {
if ($height > $width) {
$new_h = 640;
$new_w = 480;
} else {
$new_w = 640;
$new_h = 480;
}
} elseif ($size == "L") {
if ($height > $width) {
$new_h = 960;
$new_w = 720;
} else {
$new_w = 960;
$new_h = 720;
}
} elseif ($size == "S") {
if ($height > $width) {
$new_h = 240;
$new_w = 180;
} else {
$new_w = 180;
$new_h = 240;
}
}
$img = imagecreatetruecolor ($new_w,$new_h);
imagecopyresampled ($img,$src,0,0,0,0,$new_w,$new_h,$width,$height);
$img2 = imagerotate($img, $degrees, 0);
imagejpeg($img2, '', 90);
imagedestroy($img2);
?>
But this does work
http://bevrob6.100webspace.net/rlnz/thumb.php?folder=HKG&pname=228.jpg°rees=270&size=M
<?php
$filename = "http://www.mysite.com/travel/$folder/$pname";
$off_site = $filename;
$fp = fopen ($off_site, 'rb') or die('Unable to open file '.$off_site.' for reading');
$buf = '';
while (!feof ($fp))
{
$buf .= fgets($fp, 4096);
}
header('Content-Type: image/jpeg');
$data = $buf;
$size = 150;
$pc = 5;
$src = imagecreatefromstring ($data);
$width = imagesx($src);
$height = imagesy($src);
$aspect_ratio = $height/$width;
$aspect_ratio2 = $width/$height;
if ($height <= $size) {
$new_h = 150;
$new_w = 150;
} else {
$new_w = 150;
$new_h = 150;
}
$img = imagecreatetruecolor ($new_w,$new_h);
imagecopyresampled ($img,$src,0,0,0,0,$new_w,$new_h,$width,$height);
$img2 = imagerotate($img, $degrees, 0);
imagejpeg($img2, '', 90);
imagedestroy($img2);
?>
Any ideas?