recreate all images for all table uploads

7 posts by 2 authors in: Forums > CMS Builder
Last Post: December 21   (RSS)

I am looking for a plugin to iterate over each table, find any upload fields and recreate the images for each thumb. I can write one if it does not exist, but some direction on how the recreate works would be helpful.

I want to be able to select a single table or all and then process the table(s) for each size. I looked through the upload_functions but could not figure out where to start.

Jeff Shields
yaadev.com

Hi Jeff, 

Try: CMS Setup >Database Editor > Your Menu > Your Upload Field > Modify > Thumbnail Settings > "recreate" link.  That should automatically recreate all your thumbnails.

Let me know if that works for you.  Thanks!

Dave Edis - Senior Developer
interactivetools.com

Hi Jeff, 

Sure, here's where the relevant code is: 

  • recreateThumbnails(num) in /cmsb/lib/menus/database/editField_functions.js
  • recreateThumbnails() in /cmsb/lib/upload_functions.php
  • And the code that triggers it is in /cmsb/lib/menus/database/editField.php
<a href="#" onclick="recreateThumbnails('<?php echo $num ?>'); return false;" id="recreateThumbnailsLink<?php echo $num ?>"><?php echo t('recreate'); ?></a>
<span id="recreateThumbnailsStatus<?php echo $num ?>"></span>

If you could piggyback on that code, it might be easiest.  Through the web, you could loop over your tables and create an iframe with each upload field that triggered the start of the js process.  Or, from the command line you could call the PHP recreateThumbnails() directly and fake the $_REQUEST values to make it do what you want.

Hope that helps!

Dave Edis - Senior Developer
interactivetools.com

Perfect, I will dig into it a bit deeper over the next 2 weeks

Jeff Shields
yaadev.com

I was researching the iframe idea and looked through several plugins. However, I am unsure what you mean or why I might need an iframe.

Could you provide a bit more detail?

Thanks.

Jeff Shields
yaadev.com

HI Jeff,

I thought we could make use of the CMSB functionality but taking a closer look it didn't seem feasible.  

Try the attached command line script, if you can get it working, and then have it loop over all your tables, fields and thumb numbers, it might do what you need.

Dave Edis - Senior Developer
interactivetools.com
Attachments:

resizer.php 6K