?
Solved

PHP Image Resize

Posted on 2003-03-01
8
Medium Priority
?
186 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

801 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