Hi again guys, :-)
Thanks to the educated (and excellient) help of Chris
and trevor I am now getting proportionate thumbs
(which was "problem 1", remember? )

Heres the code that i am using, if it may help anyone
else:

** code start **
$src_img =  imagecreatefromjpeg("tgp1.jpg");
$img_dim = getimagesize("tgp1.jpg");

$h_1 = $img_dim[1];
$w_1 = $img_dim[0];

$dst_h = 120;
$dst_w = $w_1 * ($dst_h / $h_1);

$dst_img = imagecreatetruecolor($dst_w,$dst_h);
$src_w = imagesx($src_img);
$src_h = imagesy($src_img);
imagecopyresampled($dst_img,$src_img,0,0,0,0,$dst_w,$dst_h,$src_w,$src_h);
// problem 1 solved till here
** code end **


Then i am trying to work with problem 2, instead of
starting all over again from the beginning of getting
the images dimensions etc I am continueing and trying
to get it straight from the above like so:

** code start problem 2**
$dst_w = ($dst_w - 90) / 2;
$dst_h = 0;  // because the image is only 120px high

imagecopyresampled($dst_img,$src_img,0,0,0,0,$dst_w,$dst_h,$src_w,$src_h);

ImageJPEG($dst_img,'test.jpg');
echo "<img src=test.jpg><br>The bitch works!";
** code end problem 2 **

When i check the output I am only getting the first
parts output... is what i am doing even possible? or
do I have to do everything from the start for problem
2 (eg: read from disk, calculate dimensions etc)

Thanks,
Mag



=====
------
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)


                
__________________________________
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.
http://promotions.yahoo.com/new_mail 

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

Reply via email to