Jump to content
amstrong32

Resize images questions

Recommended Posts

Hi,

I have done a few sites with PW now and love it — thanks so much for it.

Up to now, I've done image resizing in the templates but this can make the font-end very slow when images are generated (but is fine for subsequent pages loads).

To speed it up I have:

Enabled client-side browser-resizing so huge images are scaled down before upload
Added an InputfieldFile::fileAdded hook so images are re-sized in the admin so the front-end should never have to resize
This seems to work great, I just wanted a second opinion to confirm that:

Variations created this way will be deleted when the page is deleted, i.e. I do not need a fileDeleted hook
The front-end will never re-generate the images (presuming the admin created them) when I call $image->size($imgWidth, $imgHeight)
I believe the above two assumptions are correct; I just wanted it confirming. 

Thanks!

Share this post


Link to post
Share on other sites
6 hours ago, amstrong32 said:

Variations created this way will be deleted when the page is deleted, i.e. I do not need a fileDeleted hook
The front-end will never re-generate the images (presuming the admin created them) when I call $image->size($imgWidth, $imgHeight)
I believe the above two assumptions are correct; I just wanted it confirming. 

Hello, your assumptions are correct. ProcessWire should delete all images along with their variations when a page is deleted (trash emptied / skipped). However, cleaning up no longer used variations is a different matter (meaning you still have the page but not all image variations are actually in use):

Also, if ProcessWire have already generated a given image variation, it will not regenerate it on each page request, of course. Forum topics exist on how to regenerate them "forcefully": https://www.google.hu/search?q=regenerate+image+variations+site%3Aprocesswire.com

Hope that helps.

  • Like 4

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...