-1

I had been using the image resize class written by someone else to resize images or to create the thumbnails, here is the link to the class I had been using.

http://www.white-hat-web-design.co.uk/articles/php-image-resizing.php

I guess image GD library has some limitations for the resolution or the file size of images, it works fine for low resolution picture resizing(below 1024px) but it does not resize if I try to upload the high resolution jpeg image (i.e 3400px X 2200px) roughly,

The purpose for resizing the image is i am developing a picture gallery application.

Is there any way I could bypass the limit put on by the image gd library (I am on shared hosting any changes to the system file my host wont agree). ?

Or is is that I should be using the imageMagick for this purpose(my host have installed imageMagick)? I am not so familiar with using imageMagick is there any built in plugin or class I could use for this purpose?

Is there any reccomendation for any jquery plugin that could do my work?

thank you

iCollect.it Ltd
  • 92,391
  • 25
  • 181
  • 202
Ibrahim Azhar Armar
  • 25,288
  • 35
  • 131
  • 207
  • what does "it does not resize" mean? – bcosca Nov 25 '10 at 14:00
  • it means it just upload the picture with intact resolution, i am writing the script such that it re-sizes the image and then store it on the server. – Ibrahim Azhar Armar Nov 25 '10 at 14:04
  • then there's something wrong with your script if it doesn't resize properly, if at all. i don't think any gd-imposed limit is the issue – bcosca Nov 25 '10 at 14:24
  • @stillstanding nope the problem is not with the script, if you have used GD library then you might be knowing it has default memory limit, so only it cannot upload higher resolution images, all i had to do is while instantiating the image object i had to define memory limit using ini_set ( "memory_limit", "48M"); function and now it works perfectly fine for high resolution images too. – Ibrahim Azhar Armar Nov 25 '10 at 15:10
  • See this question and answer for tips on efficient image resizing in PHP: http://stackoverflow.com/questions/12661/efficient-jpeg-image-resizing-in-php – Steve-o Jan 06 '11 at 09:45

2 Answers2

1

Try the imagecopyresized function,
which is built in,
need not to re-compile (your share hosting will be happy),
and provide almost simple feature for image processing

Jquery is clients javascript library,
it does not help with image processing

ajreal
  • 46,720
  • 11
  • 89
  • 119
  • thank you i appreciate it, it was the simplest solution, but i would like to stick with the above class i had to just add ini_set ( "memory_limit", "48M"); to increase my memory limit and then it is working fine for me. :) – Ibrahim Azhar Armar Nov 25 '10 at 15:07
0

The problem is that your memory is getting full if you try to resize a very large image with GD library.

You sould use ImageMagick. use the following code

exec("source -resize size destination");

So if you want to resize logo.gif with a maximum size of 64x64 and rename it to resize_logo.gif

exec("convert logo.gif -resize 64x64  resize_logo.gif");

For more information follow this link

Vitrix
  • 11
  • 2