ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Cron job to sychronize file upload destinations

June 07, 2013 4:09am

Subscribe [2]
  • #1 / Jun 07, 2013 4:09am

    tomjeatt

    19 posts

    I have an image directory on my server (mapped to a file upload destination in ExpressionEngine’s file manager) which is automatically updated every day with a new batch of images.

    I have a couple of image manipulations which need to be run on all files in that directory. Is it possible to set up a cron job to do the equivalent of pressing the synchronize files button so that those image manipulations are automatically created once a day?

  • #2 / Feb 12, 2014 4:44pm

    Tom, did you ever find a solution to this? I’m needing to do this on a project I’m currently working on.

  • #3 / Feb 13, 2014 8:59am

    tomjeatt

    19 posts

    Not exactly. I couldn’t find a way to do this using native functionality, but I did manage to work around it. The image directory is still updated once a day, but rather than using native image manipulations, the other sizes I need are generated on the fly using CE Image. The plugin seems to have some magical cache-busting properties because there’s never any mismatch between replaced images/generated images even though all updated images have the same file name.

    This turned out to be a much better solution in the end. CE Image is a lot easier to work with than native image manipulations, and it’s also saved a ton of disk space. I was maintaining a directory of 2000 + images and creating 3 manipulations for each. That gave me 8000 + image files, most of which were never used. Now I just have the original images, plus the relevant manipulations for the small proportion of images which are actually served.

    The only potential downside is that the image directory isn’t being synced with the file manager table in the EE database, but in my case that’s had no impact at all as the correct images are served regardless.

    Even if I found a way to achieve the same thing natively, I’d do it this way. Because image manipulation sizes/properties are controlled in the template code it’s a lot easier to develop with. No need to go back to the file manager, specify a new manipulation, and then sync the file directory. Just edit the tag and refresh the browser!

    Reading that back it sounds a bit evangelical, but it’s a really good plug in and I’ve made it part of my default install for new projects.

    CE Image: The Little Plugin that Could.

  • #4 / Feb 13, 2014 1:36pm

    Holy cow, that is one amazing plugin!
    How have I not seen that before?? A few lines of code, and I am done!

    Thanks for the tip! This will go in my default set of plugins for sure.

  • #5 / Feb 14, 2014 8:26am

    tomjeatt

    19 posts

    No problem, glad it was useful!

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases