SCC's avatar
Level 7

[Not Laravel Specific] Should I restrict gallery images to a certain size.

Hi,

I am in the process of building the gallery section of my history site. It's all fine however I am just looking at image sizes (dimensions, not MB) and wondering if anyone has any experience in this kind of thing.

Basically I am wondering if there is any particular reason I should restrict the size of uploaded images. For example the image I am looking at right now has the dimensions of 2048 x 1536.

That may well be generally too big for some screens that visit the site, however I am using bootstrap and the img-responsive class so that should really take care of that issue.

But not being used to image processing I wonder whether I should resize it above a certain dimension. Part of my thinking is perhaps later I create a new non responsive design and it means images could be all over the screen due to the size. But then I can't really see why a responsive design is not the way forward.

I really want to give each visitor the best view of the images for their resolution and that seems to be leave the images alone and rely on the responsive element to tailor the size.

A little twitchy perhaps because I have c6,000 images that will eventually go in and I don't want to get to the 6,000th and go FFS I should have done further manipulation of the images on upload.

0 likes
5 replies
taijuten's avatar
Level 10

What I tend to do is use something like glide for displaying images

http://glide.thephpleague.com/api/size/

When displaying a gallery, I'd always show resized images. Clicking on an image could then load the full size image.

Remember, using bootstrap, the client will still download the full size image, even if it's resized client-side, unless you use a server-side image processing utility like glide.

1 like
Penderis's avatar

If you want people to very well have access to a HD image you would give it as a option but for page load and speed resizing will be a necessity, decide what your smallest size medium and large will be kinda like wordpress , resize the images to those sizes and use them in your layouts, imagick does a great job already or even just the default php gd library with intervention image to use as interface within laravel.

By default you would always have to optimize images for display even if you do not have a upload limit per say.

1 like
rleger's avatar

+1 for glide, great package. Handles image caching so they don't need to be generated over and over again.

Personally this is how I do it : I store the images that are uploaded to an originals folder. I allow a fairly large picture to be uploaded. When the image is uploaded it gets resized to a standard size and format to a "processed" folder.

The rest of the application uses images from the processed folder that I know won't be too large. I use glide to make the final size, format, quality.. adjustments at the last minute. But now, if apple ever comes up with 10K screens :) I can "reprocess" the images from the originals folder with maximum quality.

Definitely not perfect but that's the best compromise I could come up with.

1 like
SCC's avatar
Level 7

Thanks, page load and speed is of course an issue, scanning through the images I have there are some quite chunky images there which could be trimmed down without loosing quality.

I am using intervention for manipulation, had not looked at Glide before so will check that out too, by the looks of it intervention is tied into it anyway.

SCC's avatar
Level 7

On another note, how are you storing the image, in particular the structure. I have been creeping about other gallery software and the method varies.

I see some just storing all the image and thumbnails in a single folder but others create lots of folders, such as:

Images
    Gallery
        Category
            Sub Category
            Thumbnails

That's a lot of folders if you have many categories and sub categories, surely the database should be your organiser?

Please or to participate in this conversation.