Link to home
Start Free TrialLog in
Avatar of RavenClaw
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?
Avatar of VGR
VGR

GD
Avatar of RavenClaw

ASKER

yea inst GD for UNIX?
ASKER CERTIFIED SOLUTION
Avatar of VGR
VGR

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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
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
Try that:

function make_icon_jpg($source,$dest)
 {
  $src_img = imagecreatefromjpeg($source);
  $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,$new_w,$new_h,imagesx($src_img),imagesy($src_img));
  $ok = imagejpeg($dst_img,$dest );
  if (!$ok )
    echo "ERROR<br>";
  else {
    echo "Ok!<br>";
  }

Phetu  
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
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 ???!?)