My php program to resize an jpeg image is as follows,
?php
// File and new size
$filename = '\bala\testPHP\ Lavanya\Kids2.j peg';
//$filename = 'Kids2.jpeg';
$percent = 0.5;
// Content type
//header('Content-type: image/jpeg');
// Get new sizes
list($width, $height) = @getimagesize($ filename);
echo getimagesize($f ilename);
$newwidth = $width * $percent;
$newheight = $height * $percent;
echo "step";
// Load
//$thumb = imagecreatetrue color($newwidth , $newheight);
//echo "1 step";
$source= @imagecreatefro mjpeg($filename );
$textcolor = imagecoloralloc ate($source, 0, 0, 255);
imagestring($so urce, 1, 5, 5, "Error loading $imgname",$text color);
//$source = imagecreatefrom jpeg($filename) ;
echo "2 step";
// Resize
imagecopyresize d($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
// Output
imagejpeg($thum b);
echo "successful ly completed";
?>
it returns the following error
getimagesize(\b ala\testPHP\Lav anya\Kids2.jpeg ): failed to open stream: No such file or directory in /home/bcns/public_html/bala/testPHP/Lavanya/imageprocess.ph p on line 13
step
?php
// File and new size
$filename = '\bala\testPHP\ Lavanya\Kids2.j peg';
//$filename = 'Kids2.jpeg';
$percent = 0.5;
// Content type
//header('Content-type: image/jpeg');
// Get new sizes
list($width, $height) = @getimagesize($ filename);
echo getimagesize($f ilename);
$newwidth = $width * $percent;
$newheight = $height * $percent;
echo "step";
// Load
//$thumb = imagecreatetrue color($newwidth , $newheight);
//echo "1 step";
$source= @imagecreatefro mjpeg($filename );
$textcolor = imagecoloralloc ate($source, 0, 0, 255);
imagestring($so urce, 1, 5, 5, "Error loading $imgname",$text color);
//$source = imagecreatefrom jpeg($filename) ;
echo "2 step";
// Resize
imagecopyresize d($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
// Output
imagejpeg($thum b);
echo "successful ly completed";
?>
it returns the following error
getimagesize(\b ala\testPHP\Lav anya\Kids2.jpeg ): failed to open stream: No such file or directory in /home/bcns/public_html/bala/testPHP/Lavanya/imageprocess.ph p on line 13
step
Comment