?
Solved

PHP Image Resize

Posted on 2003-03-01
8
Medium Priority
?
187 Views
Last Modified: 2009-07-29
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?
0
Comment
Question by:RavenClaw
8 Comments
 
LVL 15

Expert Comment

by:VGR
ID: 8047839
GD
0
 

Author Comment

by:RavenClaw
ID: 8047875
yea inst GD for UNIX?
0
 
LVL 15

Accepted Solution

by:
VGR earned 300 total points
ID: 8047892
not at all

do a phpinfo() there are chances that you see the module GD (version witout GIF)
0
Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

 
LVL 6

Expert Comment

by:carchitect
ID: 8047959
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
0
 
LVL 15

Expert Comment

by:VGR
ID: 8048012
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
0
 
LVL 2

Expert Comment

by:Phetu
ID: 8050337
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  
0
 

Author Comment

by:RavenClaw
ID: 8051288
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
0
 
LVL 15

Expert Comment

by:VGR
ID: 8051314
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 ???!?)
0

Featured Post

Take Control of Web Hosting For Your Clients

As a web developer or IT admin, successfully managing multiple client accounts can be challenging. In this webinar we will look at the tools provided by Media Temple and Plesk to make managing your clients’ hosting easier.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses four methods for overlaying images in a container on a web page
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses

589 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question