yeah I guess not everybody is running linux....
Donald J Organ IV wrote:
yess but you will have to load the image into memory anyway to create
the alternate sizes.
Kenneth Downs wrote:
I think there is a call to get image stats without loading it into
memory.
Donald J Organ IV wrote:
The best way to do this and keep the same scale is, a quick example
of this would be;
$maxWidth = 100;
$maxHeight = 100;
$im = imagecreatefromjpeg( 'path/to/file' ); //This of course would
be for a jpeg
$scale = min(100/imagesx( $im ), 100/imagesy($im) );
$newHeight = $scale * imagesy( $im );
$newWidth = $scale * imagesx( $im );
those will give you the new height and width(to scale);
chad qian wrote:
I run php to upload/resize images now.But I have one question:
After people upload images, if we want to resize the image,we must
maintain the original aspect ratio. This prevents the image from
being "stretched" or "squashed".
Now people upload two images.And I need to resize these two images
1) "1.jpg" 40*50
2) "2.jpg" 10*20
My thought:(size is height and width here)
"1.jpg" or "2.jpg" will be "stretched" or "squashed" if we keep
them as same size.
"1.jpg" and "2.jpg" will maintain the original aspect ratio but
different size
Is it right?
Thanks!
chad
------------------------------------------------------------------------
Watch “Cause Effect,” a show about real people making a real
difference. Learn more.
<http://im.live.com/Messenger/IM/MTV/?source=text_watchcause>
------------------------------------------------------------------------
_______________________________________________
New York PHP Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk
NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com
Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php
------------------------------------------------------------------------
_______________________________________________
New York PHP Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk
NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com
Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php
--
Kenneth Downs
Secure Data Software, Inc.
www.secdat.com www.andromeda-project.org
631-689-7200 Fax: 631-689-0527
cell: 631-379-0010
------------------------------------------------------------------------
_______________________________________________
New York PHP Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk
NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com
Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php
------------------------------------------------------------------------
_______________________________________________
New York PHP Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk
NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com
Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php
--
Kenneth Downs
Secure Data Software, Inc.
www.secdat.com www.andromeda-project.org
631-689-7200 Fax: 631-689-0527
cell: 631-379-0010
_______________________________________________
New York PHP Community Talk Mailing List
http://lists.nyphp.org/mailman/listinfo/talk
NYPHPCon 2006 Presentations Online
http://www.nyphpcon.com
Show Your Participation in New York PHP
http://www.nyphp.org/show_participation.php