nayen — 2012-12-30T02:44:02-05:00 — #1
In my application, I need to change the dimensions of an uploaded image. I did some research and learned that it was possible with the GD extension. I was wondering if there is another way which doesn't require an extension.
Thanks for any ideas.
rubble — 2012-12-30T04:36:43-05:00 — #2
What is you reason for not using GD; It has been included in php for years.
nayen — 2012-12-30T04:59:24-05:00 — #3
SOLVED I revised my code using jQuery and I don't need image resizing anymore, found an alternative way to accomplish what I wanted.
The reason is that this is an application that will be distributed and I didn't want "You should have GD extension enabled" type of requirement in my application.
lemon_juice — 2012-12-30T05:02:05-05:00 — #4
If you don't want an extension then you can use ImageMagick if it is installed on the server, then you can run ImageMagick's commands (convert, mogrify, etc.) directly with exec() in php. Many hosts have ImageMagick installed, some don't. There's also Imagick php extension for using ImageMagick so that is also an option if it's installed.
I always use ImageMagick for image resizing and manipulation in php - in comparison with GD it creates better quality images, has more features, it's faster and doesn't choke on large images. Nowadays so many hosts offer ImageMagick that it's not a problem at all - unless you want to make a distributed library for others to download and it needs to work on as many platforms as possible.
lemon_juice — 2012-12-30T05:06:04-05:00 — #5
I hope your jQuery solution is not resizing images in the browser. Sometimes I can see web galleries where small thumbnails are actually large images that are made smaller in the browser by changing <img> dimensions - such pages are slow to load, waste bandwidth and often the quality of the small thumbnails is not very good.
nayen — 2012-12-30T05:49:32-05:00 — #6
Thanks for your detailed reply. If I ever need image resizing on my own website, I will most probably use it but as I said above, this application will be distributed and I can't have GD or ImageMagick as a requirement. I just wanted to know if there was another PHP way and it seems not.
There is only one image in one certain section that is resized so even if it is resizing in the browser, that will not be a problem.
scallioxtx — 2012-12-30T07:25:52-05:00 — #7
Can't you just check if GD is available and if so use it, otherwise use the jQuery plugin? GD will be available most of the cases, making for a much nicer solution IMHO.
system — 2014-10-07T23:27:43-04:00 — #8
This topic is now closed. New replies are no longer allowed.