Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Plugin Suggestions!
#24
Good morning
I have just developed a Regenerate Thumbnails plugin to allow you to regenerate all thumbnails of all uploaded images in your data/downloads folder and subfolder.
This is useful in situations such as:
The thumbnail size has changed and you want previous uploads to have a thumbnail of this size.
You've moved to a new GetSimple theme that uses thumbnail images of different sizes.
To free up space on the server, you can delete old, unused thumbnails from the data/thumbs folder and subfolder.
How can I share it with the GetSimple community?
If you find an error contact me!


PHP Code:
<?php
/*
Plugin Name: regenerate_thumbnails
Description: regenerate thumbnails.
Version: 1.0
Author: jjancel 27/04/2024 15:00
Author URI: http://jjancel.free.fr/
*/
 
# get correct id for plugin
$thisfile=basename(__FILE__".php");

# register plugin
register_plugin(
  $thisfile,       # Plugin id
  'Regenerate Thumbnails'# Plugin name
  '1.0',      # Plugin version
  'jjancel',  # Plugin author
  'http://jjancel.free.fr/'# author website
  'Regenerate Thumbnails'# Plugin description
  'files'# page type of plugin
  'regenerate_thumbnails_show' # main plugin function
);

# activate filter
add_action('files-sidebar','createSideMenu',array($thisfile,'Regenerate Thumbnails'));

# functions
function regenerate_thumbnails_show() {
 if (isset(
$_POST['submitted'])) {
  echo '<h3>list of all images in the data/uploads folder and subfolders</h3>';
  $uploaddir '../data/uploads';
  listFolderFiles($uploaddir);
 }
    echo 
'<h3>How use Regenerate Thumbnails on your files?</h3>';
 echo 
"<p>Regenerate Thumbnails allows you to regenerate all thumbnails for all uploaded images in your data/uploads folder and sub folder.</p> <p>This is useful in situations such as:</p> <ul>     <li>The thumbnail size has changed and you want previous uploads to have a thumbnail of this size.</li>     <li>You've moved to a new GetSimple theme that uses thumbnail images of a different size.</li> </ul> <p>In order to free up space on the server you can delete old, unused thumbnails from the data/thumbs folder and sub folder.</p>";
    echo 
'<form method="post" action="';
 echo 
$_SERVER["PHP_SELF"];
 echo 
'?id=regenerate_thumbnails"> <input type="submit" name="submitted"/> </form>';
}

# functions thumbnails
function frmtFolder($Entity) {
 echo 
'<li style="font-weight:bold;color:black;list-style-type:none">'.$Entity;
}

function 
frmtFile($dEntry$fEntry) {
 if (
preg_match('/(\.gif|\.jpg|\.jpeg|\.png|\.webp)$/i'$fEntry)) {
  $subFolder substr($dEntry16).'/';
  echo '<li style="list-style-type:square">'.'<a href="'.$dEntry.'/'.$fEntry.'"> '.$fEntry.' </a><br>';
        
// generate thumbnail                
        
require_once('inc/imagemanipulation.php');    
        
genStdThumb($subFolder,$fEntry);
 }
}

function 
listFolderFiles($dir) {
 
$ffs scandir($dir);
 unset(
$ffs[array_search('.'$ffstrue)]);
 unset(
$ffs[array_search('..'$ffstrue)]);
 unset(
$ffs[array_search('index.html'$ffstrue)]);
 
// prevent empty ordered elements
 
if (count($ffs) < 1) {return;}
 echo 
'<ul>';
 foreach (
$ffs as $ff) {
  if (is_dir($dir '/' $ff)) {
   frmtFolder($dir);
  } else {
   frmtFile($dir$ff);
  }
  if (is_dir($dir '/' $ff)) {
   listFolderFiles($dir '/' $ff);
  }
  echo '</li>';
 }
 echo 
'</ul>';
}
?>


Attached Files
.php   regenerate_thumbnails.php (Size: 2.71 KB / Downloads: 4)
Reply


Messages In This Thread
Plugin Suggestions! - by ccagle8 - 2010-02-10, 10:10:48
RE: Plugin Suggestions! - by jjancel - 2024-04-28, 02:22:04
RE: Plugin Suggestions! - by Oleg06 - 2024-09-16, 21:54:01
Plugin Suggestions! - by internet54 - 2010-02-10, 10:46:45
Plugin Suggestions! - by maxtuska - 2010-02-10, 21:10:30
Plugin Suggestions! - by Nijikokun - 2010-02-18, 12:14:47
Plugin Suggestions! - by crashfellow - 2010-03-08, 21:37:09
Plugin Suggestions! - by Zegnåt - 2010-03-08, 21:51:02
Plugin Suggestions! - by crashfellow - 2010-03-08, 22:15:34
Plugin Suggestions! - by baris - 2010-03-15, 10:33:33
Plugin Suggestions! - by juliancc - 2010-03-15, 11:37:32
Plugin Suggestions! - by Jamz - 2010-03-16, 10:09:38
Plugin Suggestions! - by FredK - 2010-03-17, 08:19:54
Plugin Suggestions! - by Zegnåt - 2010-03-17, 08:38:28
Plugin Suggestions! - by FredK - 2010-03-17, 09:40:50
Plugin Suggestions! - by baris - 2010-03-19, 11:36:57
Plugin Suggestions! - by HeatherFeuer - 2010-03-30, 09:02:49
Plugin Suggestions! - by Sibrus - 2010-04-18, 03:15:18
Plugin Suggestions! - by juliancc - 2010-04-18, 05:35:34
Plugin Suggestions! - by Roberto - 2010-05-29, 18:49:11
Plugin Suggestions! - by xd1936 - 2010-06-03, 13:00:39
Plugin Suggestions! - by Zegnåt - 2010-06-03, 16:54:01
Plugin Suggestions! - by xd1936 - 2010-06-04, 02:51:28
Plugin Suggestions! - by Jamz - 2010-07-10, 08:55:03
Plugin Suggestions! - by dominionit - 2010-10-02, 06:00:47



Users browsing this thread: 2 Guest(s)