RE: [PHP] picture help

2003-06-19 Thread Edward Peloke
thanks Jason,

This worked much better!

Eddie

-Original Message-
From: Jason Wong [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 18, 2003 5:23 PM
To: [EMAIL PROTECTED]
Subject: Re: [PHP] picture help


On Thursday 19 June 2003 05:05, Edward Peloke wrote:
> thanks, I tried and it doesn't help.  For some reason some of the pictures
> I upload look fine and some look bad no matter if I use imagecopyresampled
> or resized

> > $newimg=imagecreate($nw,$nh);

Use imagecreatetruecolor() instead.

--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
Kime's Law for the Reward of Meekness:
Turning the other cheek merely ensures two bruised cheeks.
*/


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] picture help

2003-06-18 Thread Jason Wong
On Thursday 19 June 2003 05:05, Edward Peloke wrote:
> thanks, I tried and it doesn't help.  For some reason some of the pictures
> I upload look fine and some look bad no matter if I use imagecopyresampled
> or resized

> > $newimg=imagecreate($nw,$nh);

Use imagecreatetruecolor() instead.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
Kime's Law for the Reward of Meekness:
Turning the other cheek merely ensures two bruised cheeks.
*/


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] picture help

2003-06-18 Thread Edward Peloke
thanks, I tried and it doesn't help.  For some reason some of the pictures I
upload look fine and some look bad no matter if I use imagecopyresampled or
resized

-Original Message-
From: Lars Torben Wilson [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 18, 2003 4:49 PM
To: Edward Peloke
Cc: [EMAIL PROTECTED] Php. Net
Subject: Re: [PHP] picture help


On Wed, 2003-06-18 at 13:39, Edward Peloke wrote:
> Hello all, I have this code that takes an image sent from a form and
resizes
> it for a thumbnail and for display, the problem is the pictures look nice
> until this does the resizing, then the quality is horrible...can I fix it?
>
> Thanks,
> Eddie

If you have GD version 2.0.1 or later and PHP 4.0.6 or later, try using
imagecopyresampled() instead of imagecopyresized(). You may get better
results.


Good luck,

Torben

>  if(!empty($myimage)){
> $id=$HTTP_GET_VARS['id'];
> $imgname="image_".$id.".jpg";
> copy($myimage,$imgname);
> unlink($myimage);
> function thumbnail($i,$nw,$p,$nn) {
> $img=imagecreatefromjpeg("$i");
> $ow=imagesx($img);
> $oh=imagesy($img);
> $scale=$nw/$ow;
> $nh=ceil($oh*$scale);
> $newimg=imagecreate($nw,$nh);
> imagecopyresized($newimg,$img,0,0,0,0,$nw,$nh,$ow,$oh);
> imagejpeg($newimg, $nn);
> return true;
> }
>
> #thumbnail(filetouse,newwidth,newpath,newname);
> thumbnail($imgname,100,"/imges/","t_".$imgname);
> thumbnail($imgname,250,"/imges/",$imgname);
>
> }
> ?>
--
 Torben Wilson <[EMAIL PROTECTED]>+1.604.709.0506
 http://www.thebuttlesschaps.com  http://www.inflatableeye.com
 http://www.hybrid17.com  http://www.themainonmain.com
 - Boycott Starbucks!  http://www.haidabuckscafe.com -




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] picture help

2003-06-18 Thread Lars Torben Wilson
On Wed, 2003-06-18 at 13:39, Edward Peloke wrote:
> Hello all, I have this code that takes an image sent from a form and resizes
> it for a thumbnail and for display, the problem is the pictures look nice
> until this does the resizing, then the quality is horrible...can I fix it?
> 
> Thanks,
> Eddie

If you have GD version 2.0.1 or later and PHP 4.0.6 or later, try using
imagecopyresampled() instead of imagecopyresized(). You may get better 
results.


Good luck,

Torben

>  if(!empty($myimage)){
> $id=$HTTP_GET_VARS['id'];
> $imgname="image_".$id.".jpg";
> copy($myimage,$imgname);
> unlink($myimage);
> function thumbnail($i,$nw,$p,$nn) {
> $img=imagecreatefromjpeg("$i");
> $ow=imagesx($img);
> $oh=imagesy($img);
> $scale=$nw/$ow;
> $nh=ceil($oh*$scale);
> $newimg=imagecreate($nw,$nh);
> imagecopyresized($newimg,$img,0,0,0,0,$nw,$nh,$ow,$oh);
> imagejpeg($newimg, $nn);
> return true;
> }
> 
> #thumbnail(filetouse,newwidth,newpath,newname);
> thumbnail($imgname,100,"/imges/","t_".$imgname);
> thumbnail($imgname,250,"/imges/",$imgname);
> 
> }
> ?>
-- 
 Torben Wilson <[EMAIL PROTECTED]>+1.604.709.0506
 http://www.thebuttlesschaps.com  http://www.inflatableeye.com
 http://www.hybrid17.com  http://www.themainonmain.com
 - Boycott Starbucks!  http://www.haidabuckscafe.com -




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] picture help

2003-06-18 Thread Jason Wong
On Thursday 19 June 2003 04:39, Edward Peloke wrote:
> Hello all, I have this code that takes an image sent from a form and
> resizes it for a thumbnail and for display, the problem is the pictures
> look nice until this does the resizing, then the quality is horrible...can
> I fix it?

> imagecopyresized($newimg,$img,0,0,0,0,$nw,$nh,$ow,$oh);

You would get better results using imagecopyresampled().

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
"In the face of entropy and nothingness, you kind of have to pretend it's not
there if you want to keep writing good code."  -- Karl Lehenbauer
*/


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] picture help

2003-06-18 Thread Boaz Yahav
This might help :

array img_resize(string 'path to source image', string 'path to
destination image', string mode, int size); 
modes: 
"h" - Height 
"w" - Width 
"a" - auto (resizes by the largest dimension)

http://examples.weberdev.com/get_example.php3?count=157

Sincerely

berber

Visit http://www.weberdev.com/ Today!!!
To see where PHP might take you tomorrow.


-Original Message-
From: Edward Peloke [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, June 18, 2003 10:39 PM
To: [EMAIL PROTECTED] Php. Net
Subject: [PHP] picture help


Hello all, I have this code that takes an image sent from a form and
resizes it for a thumbnail and for display, the problem is the pictures
look nice until this does the resizing, then the quality is
horrible...can I fix it?

Thanks,
Eddie




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php