RavenClaw
asked on
PHP Image Resize
i got apache 1.3.7 and windows XP with php 4.3 sumthing installed, i have a form that uploads a image only .jpeg or .jpg and it stores it right. but i want PHP to make a copy of the image and make a thumbnail of it. i no it can be done on unix ans linux but i dont no how on windows?
GD
ASKER
yea inst GD for UNIX?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi why don't you simple create <img> tag with fixed height and width...
simple..
why to make a copy.. and for copy even just use copy function
regards
simple..
why to make a copy.. and for copy even just use copy function
regards
not the same :D
display size would be correct, but the load time would be the one of the full-size image ; that would be a shame :D
display size would be correct, but the load time would be the one of the full-size image ; that would be a shame :D
Try that:
function make_icon_jpg($source,$des t)
{
$src_img = imagecreatefromjpeg($sourc e);
$new_w = 100;
$new_h = 100;
$src_w = imagesx($src_img);
$src_h = imagesy($src_img);
$dst_img = imagecreate($new_w,$new_h) ;
imagecopyresized($dst_img, $src_img,0 ,0,0,0,$ne w_w,$new_h ,imagesx($ src_img),i magesy($sr c_img));
$ok = imagejpeg($dst_img,$dest );
if (!$ok )
echo "ERROR<br>";
else {
echo "Ok!<br>";
}
Phetu
function make_icon_jpg($source,$des
{
$src_img = imagecreatefromjpeg($sourc
$new_w = 100;
$new_h = 100;
$src_w = imagesx($src_img);
$src_h = imagesy($src_img);
$dst_img = imagecreate($new_w,$new_h)
imagecopyresized($dst_img,
$ok = imagejpeg($dst_img,$dest );
if (!$ok )
echo "ERROR<br>";
else {
echo "Ok!<br>";
}
Phetu
ASKER
thanks for all your help guys, yeah i did phpinfo and gd wernt there :(. i found a win32 dll and installed it :) now it works Thanks
Regards
Regards
anyway, look at Phetu's suggestion, it's elegant and functional, althought I never used it (is imagecopyresized a new function for PHP > 4.2 ???!?)