RE: [PHP] Advanced maths help (part 2)
| From: | Mag | Date: | Fri, 15 Oct 2004 18:00:19 +0000 |
| Subject: | RE: [PHP] Advanced maths help (part 2) | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-199616@lists.php.net to get a copy of this message | ||
Hi Trevor,
Sorry, am just a bit confused myself mostly because I
am using a third party script to clip the 120x90 part
out of the image...understanding the way the script is
written is a little frustrating as it was written for
something else and I am trying to adopt it.
if you want to try your hand at it tell me and i'll
zip up the script and send it to you.
Thanks,
Mag
--- "Gryffyn, Trevor" <TGryffyn@air-cargo-inc.com>
wrote:
> My interpretation of Problem 2 before was that you
> wanted to get a 120w
> x 90h (?) section of the original image, not of the
> thumbnail you
> generated by resizing the original.
>
> You seem to be working off of the adjusted height.
>
> Sorry, I didn't noodle all the way through this one,
> what I am missing?
>
> -TG
>
> > -----Original Message-----
> > From: Mag [mailto:genphp@yahoo.com]
> > Sent: Friday, October 15, 2004 12:45 PM
> > To: php php
> > Subject: [PHP] Advanced maths help (part 2)
> >
> >
> > 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,$sr
> > c_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,$sr
> > c_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
> >
> >
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
=====
------
- 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!?
Declare Yourself - Register online to vote today!
http://vote.yahoo.com