Am just trying to get this to work to resize an image here :
http://www.pixelar.co.uk/framedetails.php?FrameID=4
So have the code :
<img class="WADADetailsMainImage" src="detailspic.php?file=framepics/<?php echo $row_WADAphotoframes["ImageFront"];?>" alt="Image Name" />
Where detailspic.php looks like :
<?php
// Max Sizes
$th_max_width = 380; // Maximum width of the thumbnail
$th_max_height = 380; // Maximum height of the thumbnail
//-------------------
// File
$filename = $_GET['file'];
// Get image sizes, type & mime
$img_data = getimagesize($filename);
$width = $img_data[0];
$height = $img_data[1];
$img_type = $img_data[2]; // Numeric value (check in manual)
$mime = $img_data['mime'];
// Content type
header('Content-type: ' . $mime);
// Resize
$ratio = ($width > $height) ? $th_max_width/$width : $th_max_height/
$height;
$newwidth = round($width * $ratio);
$newheight = round($height * $ratio);
// Load
$thumb = imagecreatetruecolor($newwidth, $newheight);
switch ($img_type){
case 1:
$source = imagecreatefromgif($filename);
break;
case 2:
$source = imagecreatefromjpeg($filename);
break;
// Other file types...
}
//Resize
imagecopyresampled($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight,
$width, $height);
// Output
imagejpeg($thumb);
?>
<?php
exit;
?>
If anyone could let me know what I'm missing, that would be much appreciated.
Many thanks.