Advertisement

04.01.2008 at 04:48PM PDT, ID: 23287695
[x]
Attachment Details

PHP and resizing and image

Asked by akohan in PHP Scripting Language

Tags: ,

Hello group,

I'm trying to resize an iamge from whatever size it has to Width = 320 and Height = 240 (just as part of learning phase)
Now. assume user uploads an image and after getting the width and height size I call following functions in snippets but the issue
is when I open the destination file it is a black image. Paint opens it and shows a blank image but Photoshop claims its internal information
are not valid.

Where did I go wrong?

Thanks.




Start Free Trial
1:
2:
3:
4:
$tmp = imagecreatetruecolor($new_width, $new_height);
   imagecopyresampled($dst, $file, 0,0,0,0, $new_width, $new_height, 320, 240);
				
   imagejpeg($tmp, "/var/www/html/apps/sa/usr_bg_imgs/" . "newfile.png", 100);
[+][-]04.01.2008 at 06:36PM PDT, ID: 21259506

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: PHP Scripting Language
Tags: PHP, 5
Sign Up Now!
Solution Provided By: drxav
Participating Experts: 1
Solution Grade: A
 
 
[+][-]04.02.2008 at 11:32AM PDT, ID: 21265974

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.02.2008 at 11:43AM PDT, ID: 21266082

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.02.2008 at 05:05PM PDT, ID: 21268691

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.03.2008 at 11:57AM PDT, ID: 21275729

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.11.2008 at 11:31AM PDT, ID: 21336868

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]04.11.2008 at 12:14PM PDT, ID: 21337247

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628