GD problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

Is it possible to resize jpg/gif from gd 1.7, its working fine in gd 2.0
and my webbserver wont upgrade.

This is my example (not working in gd 1.7)

<?php
// 1.php
header("Content-type: image/jpeg");
$img = $_GET["img"];

$imgSource	= @getimagesize($img);
$imgWidth	= $imgSource[0];
$imgHeight	= $imgSource[1];
$imgType	= $imgSource[2];

switch($imgType) {
 case 1:	$imgSource = imagecreatefromgif($img);  break;
 case 2:	$imgSource = imagecreatefromjpeg($img); break;
 case 3:	$imgSource = imagecreatefrompng($img);  break;
 case 15:	$imgSource = imagecreatefromwbmp($img); break;
 default:	exit;
}			

$h = ($_GET["w"]/$imgWidth)*$imgHeight;
$imgTN = @imagecreatetruecolor($_GET["w"], $h);
imagecopyresized($imgTN, $imgSource, 0, 0, 0, 0, $_GET["w"], $h,
$imgWidth, $imgHeight);
imagejpeg($imgTN, null, 80);
imagedestroy($imgTN);
?>



<img src="1.php?img=1.jpg&w=70&q=70">

-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux