I wish to produce a gallery of images for my website and upload individuals pictures in the administration panel from the website. I will show all pictures inside a page having a really small size, and something place I'll separate for every picture to exhibit the chosen picture (from small ones) with large size.

I understand two methods for doing that:

  1. I create 2 pictures for uploading from administration panel, one large and something small having a fixed size. Therefore the large one I'll load within the separate large space. And small is going to be proven within the small places. Therefore the administrator from the site should CREATE 2 photos.

  2. The 2nd way I understand is by using the GD library of PHP to have the ability to upload just the large picture, as well as in each place a PHP function will re-size the large picture and obtain the two dimensions which i demand for gallery.

The very first method's disadvantage is, the user from the site should use Illustrator as well as other tool before uploading. Let’s agree that this isn't a enjoyable factor for that site user.

The 2nd approach isn't good either, as GD resizes the image by lowering quality. Which loss is inadmissible since it is an excessive amount of.

Exactly what is a method in which does that re-size operation while keeping near to the original display quality?

Or what's another approach that's better these two?

GD does not lose quality anymore than Illustrator. Just make certain you're using imagecopyresampled() and never imagecopyresized() as that doesn't inflict type of resampling. Then save the resulting image in sufficient quality for JPEG's, that's around 80.

Then perform a similar re-size in Illustrator and you will see there isn't much difference. You may also use GD to hone your pictures, that'll provide them with some extra crispness.


I designed a tool to check different re-size techniques, give it a try and discover for yourself what's the most practical way: http://world wide web.ulmanen.fi/stuff/downsample/

Make use of the following function such as this:

Image('/path/to/original.image', '1/1', '150*', './thumb.jpg') // thumb, width = 150 px

Image('/path/to/original.image', null, '600*', './full.jpg') // full, width = 600 px

You are able to specify the crop ratio through the second argument (w/h) if you want, you may also specify the width and/or height from the resized image through the third argument (w*h).

function Image($source, $crop = null, $scale = null, $destination = null)

    else if ($crop[] < $crop[1])


    $crop = array(ImageSX($source) - $size[], ImageSY($source) - $size[1])







    if (isset($scale) === true)


    else if (empty($scale[1]) === true)








    $result = ImageCreateTrueColor($scale[], $scale[1])

    if (is_resource($result) === true)




    return false

The look is instantly enhanced (sharp) and saved like a JPEG rich in quality.