11-20-2007, 01:24 PM
on a members profile, i have the "viewimages" section, you can go in and see all the images the user has uploaded, what i was going to do is show them all as 1 size say "300x300" then when the user clicks the "View Fullsize" button the original size pops up, all fairly easy to setup, only im not sure how to just resize the images, i don't need thumbnails or anything, is there a way i can do this with GD or even imagemajick as i have both installed.
11-20-2007, 02:07 PM
You can use GD to resize images on-the-fly. You didn't mention how
many images and how many page accesses you'll have each month.
GD resizing does take processing time and consumes server load.
Someone else can interject on this, but I think it would be more efficient
to save a duplicate image that's 300X300 at the same time the user
uploads the image ... perhaps in a directory called "cache". That way,
GD only runs the one time (when they upload the image) ... not 1000
times a month when people view the image(s).
So the trade-off is using disk storage to keep those cached images VS
using GD to display them on-the-fly. I think the disk storage is cheaper
and faster than the processor time.
When they upload the image, you do your normal upload thing, and at the
very end, before you redirect back, you run a PHP (GD) script to use the
uploaded image (imagecreatefromjpg) resize it, and save into the other
directory called "cache" (or whatever you call it).
You could also do something where you check for the image in "cache" and
if it does not exist, you do the PHP GD thing to create it. Once created,
it will exist the next time someone wants to see it.
If the member deletes their photo in their own directory, you also "unlink"
the cached photo, because they will have the same exact filename, but
That's my 2 cents.
11-20-2007, 03:21 PM
That sounds like a very good solution.
To that I would add that you set up a cronjob that deletes cached images (past a certain age) at a specific interval, so that it does not grow too big.
11-20-2007, 07:16 PM
thanks a ton guys thats exactly what ill do i think.