|
Posted by eholz1 on 01/06/07 17:09
Hello Curtis and the others,
This is exactly what I needed. I am doing some testing with images,
etc. My plan is to read/check a
given image file, and load its name, size, filetype, etc into a
database, and display the image (via a thumbnail link, etc). So the
link to the php stuff is very useful, and all i need at this point is
to get image data, and do not need to process image yet (like make a
thumbnail, resize image to browser size (maybe 900 x 600, etc).
Thanks again,
eholz1,
Curtis wrote:
> If you're trying to make thumbnails, you should actually resample the
> images, otherwise, your web page will take a while to load, even if you
> change the dimensions in the image tag.
>
> See: http://php.net/manual/en/function.imagecopyresampled.php
>
> On Jan 5, 10:01 pm, "eholz1" <ewh...@gmail.com> wrote:
> > Hello PHP group,
> >
> > I am using some php code to check the size of images, and then
> > resize or determine new dimension for the image. GD seems quite slow.
> > It takes about 5 seconds (plus or minus) to calulate dimension for 7
> > jpeg images.
> >
> > I have a 700mhz processor (Pentium III, remember those??)! with almost
> > a gb of memory.
> > Is that the way GD is??? Here is a snippet of the dode I use: I pass
> > the image from an array to this function:
> >
> > function imageDimensions ($img) {
> >
> > //get size create an original image from file above
> >
> > $orig = imagecreatefromjpeg($img);
> >
> > if ($orig) {
> >
> > //get height and width
> >
> > $orig_x = imagesx($orig);
> >
> > $orig_y = imagesy($orig);
> >
> > $pic_size[0] = $orig_x; //width
> >
> > $pic_size[1] = $orig_y; //height
> > if ($orig_x > 799) {
> >
> > $image_x = 800;
> > }else{
> > $image_x = $orig_x;
> > }
> >
> > // $thumb_x = $_REQUEST['thumb_x'];
> >
> > $image_y = round(($orig_y * $image_x) / $orig_x);
> >
> > // $thumb_y = round(($orig_y * $thumb_x) / $orig_x);
> >
> > $pic_size[2] = $image_y;
> >
> > $pic_size[3] = $image_x;
> >
> > return $pic_size;
> >
> > //echo("Image width: " . $orig_x . ". Image height: " . $orig_y);
> >
> > } else {echo 'No Image!';
> >
> > }
> > }I am open to any suggestions on improving my "code" as it were!
> >
> > Thanks for a good group,
> > eholz1
[Back to original message]
|