WordPress.org

Plugin Directory

Changeset 1685851


Ignore:
Timestamp:
06/26/17 23:22:21 (4 months ago)
Author:
davidsword
Message:

v2 June 25, 2017

  • Project revival
  • Code overhaul/rewrite
  • Added better assets
  • Much cleaner and Wordpress native looking interface, no more code-line look
  • Readme, UI, and inline documentation corrected and improved
  • Improved logic of deletion
  • Improved logic for form submission with low max_input_vars values in mind
  • better detection of thumbnails & cross checking media library attachments
Location:
delete-thumbnails
Files:
15 added
1 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • delete-thumbnails/trunk/delete-thumbnails.php

    r1021577 r1685851  
    11<?php 
    22/* 
    3 Plugin Name: Delete Thumbnails 
    4 Plugin URI: http://handsomefox.com/plugins/delete-thumbnails/ 
    5 Description: Find and delete thumbnails from your Media Library 
    6 Version: 1.0 
    7 Author: davidsword 
    8 Author URI: http://handsomefox.com/ 
    9 ------------------------------------------------------------------------ 
     3Plugin Name:    Delete Thumbnails & Resized Images 
     4Plugin URI:     https://davidsword.ca/wordpress-plugins/ 
     5Description:    Find and delete thumbnails & resized images from your Media Library 
     6Version:        2.0 
     7Author:         davidsword 
     8Author URI:     https://davidsword.ca/ 
     9License:        GPLv3 
     10License URI:    https://www.gnu.org/licenses/quick-guide-gplv3.en.html 
     11Text Domain:    dlthumbs 
    1012*/ 
    1113 
    12 /*   
    13  Copyright 2009-2014 Handsome Fox Creative Studio, (http://handsomefox.com) 
    14  
    15  This program is free software; you can redistribute it and/or modify 
    16  it under the terms of the GNU General Public License as published by 
    17  the Free Software Foundation; either version 2 of the License, or 
    18  (at your option) any later version. 
    19  
    20  This program is distributed in the hope that it will be useful, 
    21  but WITHOUT ANY WARRANTY; without even the implied warranty of 
    22  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    23  GNU General Public License for more details. 
    24  
    25  You should have received a copy of the GNU General Public License 
    26  along with this program; if not, write to the Free Software 
    27  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA 
    28  */ 
    29  
    30  
    31  
    32 // get the upload dir 
    33 $dir = ABSPATH . UPLOADS; 
    34  
    35  
    36 // create custom plugin settings menu 
    37 add_action('admin_menu', 'dlthumbs_create_optionspage'); 
    38  
    39  
    40 //create new sub menu item 
    41 function dlthumbs_create_optionspage() { 
    42     global $menu, $submenu; 
    43     add_options_page('Delete Thumbnails', 'Delete Thumbnails', 'publish_posts', 'dlthumbs_custom_options', 'dlthumbs_custom_options_page',''); 
    44     add_action( 'admin_init', 'register_dlthumbs_custom_options_settings' ); 
     14// Huston ..we have lift off. 
     15add_action( 'init', 'dlthumbs' ); 
     16function dlthumbs() { 
     17    global $dlthumbs; 
     18    if (is_admin()) // admin only 
     19        $dlthumbs = new dlthumbs(); 
    4520} 
    4621 
    47  
    48 // html settings page 
    49 function dlthumbs_custom_options_page() { 
    50     global $_wp_additional_image_sizes, $dir; 
    51     if (isset($_GET['page']) && $_GET['page'] == 'dlthumbs_custom_options') : ?> 
    52  
    53     <div class='wrap'> 
    54          
    55         <div id="icon-edit" class="icon32"><br /></div> 
    56         <h2>Delete Thumbnails</h2> 
    57         <? if (dlthumbs_were_deleting()) : ?> 
    58         <div id="message" class="updated below-h2"> 
    59             <p><br /> 
    60             Congratulations! <span class='thumbnail_count'></span> thumbnails were sucessfully <strong>deleted!</strong>  
    61             </p><br /> 
    62         </div> 
    63         <? endif ?> 
    64             
    65         <p>Please Note:</p>                  
    66         <ol> 
    67             <li>When deleting, thumbnails are deleted at a code level and will be <span style='color:#DB3F3C'>deleted permanently</li> 
    68             <li>You can use <a href='http://wordpress.org/plugins/regenerate-thumbnails/' target='_Blank'>this plugin</a> to regenerate your thumbnails if needed</li> 
    69             <? if (!dlthumbs_were_deleting()) : ?> 
    70             <li>All files that will be deleted are marked with <code>[X]</code> and highlighted in red below)</li> 
    71             <li>Press the <strong>delete all thumbnails</strong> button at the bottom of the page to delete </li> 
    72             <? endif; ?> 
    73         </ol> 
    74             
    75         <?  
    76         // load files in media upload dir 
    77         $files = get_files_from_folder(array(),$dir)  
    78         ?> 
    79  
    80 <pre class='consol' style='background:#333;color:white;padding:30px;border-radius:5px;'> 
    81    Status:          <?= (dlthumbs_were_deleting()) ? "DELETING" : "READING" ?> 
    82     
    83    Reading:         <?= $dir ?> 
    84  
    85    chmod:           <?= substr(sprintf('%o', fileperms($dir)), -4); ?> 
    86                  
    87    Files:           <?= count($files) ?> 
    88  
    89    Pattern:         -###x###.{extension} 
    90    Registered: 
    91 <? foreach ($_wp_additional_image_sizes as $size => $details) echo "                    -> '{$size} ({$details['width']}x{$details['height']})\n"; ?> 
    92  
    93  
    94    -------------------------------------------------------------------------------- 
    95    <span<?=  
    96    (dlthumbs_were_deleting()) ? " style='color:red'" : "" ?>>Thumbnails <?= (dlthumbs_were_deleting()) ? "DELETED" : "Found"     
    97    ?>:    <span class='thumbnail_count'></span></span>   
    98    -------------------------------------------------------------------------------- 
    99     
    100 <? foreach ($files as $afile) echo "   {$afile}\n" ?> 
    101 </pre> 
    102             
    103         <script type='text/javascript'> 
    104             jQuery(document).ready(function() { 
    105               count = 0; 
    106               jQuery('span').each(function(){ 
    107                   if ( jQuery(this).hasClass('a_thumbnail') )  
    108                     count = count + 1 
    109               }) 
    110               jQuery('.thumbnail_count').html(count) 
    111                
    112               jQuery('#delete_button').click(function() { 
    113                 if(confirm('Are you sure you want to permanently delete all files highlighted in red? This action cannot be undone.'))  
    114                     return true;     
    115                 else  
    116                     return false; 
    117               }) 
    118                
    119             }); 
    120              
    121         </script> 
    122  
    123         <? if (dlthumbs_were_deleting()) : ?> 
    124         <a href='?page=dlthumbs_custom_options' style='' class='button button-large'>Reload This Page &raquo;</a> 
    125         <? else : ?> 
    126         <a href='?page=dlthumbs_custom_options&delete=YES_SIR' style='' class='button-primary button-large button' id='delete_button'>DELETE ALL  
    127         <span class='thumbnail_count'></span> THUMBNAILS &raquo;</a> 
    128         <? endif ?> 
    129         <br /><br /> 
    130         <span style='font-size:11px;'>Plugin by: <a href='http://handsomefox.com/'>Handsome Fox</a></span> 
    131       </div>     
    132       <? endif; 
    133  } 
    134  
    135  
    136 // function for indexing directory 
    137 // using itself from within to get sub-folder's indexed 
    138 // also used to delete thumbnails as indexing when instructed to 
    139 function get_files_from_folder($files = '',$folder,$godeep = true) { 
    140     global $dir; 
    141      
    142     if (empty($files)) $files = array(); 
    143      
    144     // start read 
    145     if (is_dir($folder)) { 
    146         $dh  = opendir($folder); 
    147         while (false !== ($filename = readdir($dh))) { 
    148             if (!in_array($filename, array('.DS_Store','.','..',''))) { 
    149  
    150                 // it's a dir, index contents w/ current function 
    151                 if (check_if_dir($filename)) { 
    152                     // repeat same function, find files within folders, 
    153                     $subfiles = get_files_from_folder(array(),str_replace('//','/',$folder.'/'.$filename.'/'),false); 
    154                     foreach ($subfiles as $subfile) 
    155                         $files[] = $subfile; 
    156                      
    157                 // it's a file 
    158                 } else { 
    159                     $style = $thumbnailfound = ''; 
    160                     $dirfile = str_replace('//','/',str_replace($dir,'',$folder).$filename); 
    161                      
    162                     // if it's a thumbnail, add indicators for reading and deleting actions/status's: 
    163                     if (is_thumbnail($dirfile)) { 
    164  
    165                         if (dlthumbs_were_deleting()) { 
    166                              
    167                             // MAIN DELETING ACTION 
    168                             @unlink($dir.$dirfile); 
    169                              
    170                             $style = "color:#666;text-decoration:line-through;"; 
    171                             $prefix = "<span style='color:green'>[DELETED]</span> "; 
    172                             $thumbnailfound = "a_thumbnail"; 
    173                         }  
    174                          
    175                         else { 
    176                             $style = "color:red"; 
    177                             $thumbnailfound = "a_thumbnail"; 
    178                             $prefix = "[X] "; 
    179                         } 
    180                      
     22class dlthumbs { 
     23    public $menu_id; 
     24     
     25    /** 
     26     * Plugin initialization 
     27     * 
     28     * @since 2.0 
     29     */ 
     30    public function __construct() { 
     31         
     32        // Load up the localization file if we're using WordPress in a different language 
     33        load_plugin_textdomain( 'dlthumbs' ); 
     34 
     35        // menu 
     36        add_action( 'admin_menu', array( $this, 'add_admin_menu' ) ); 
     37        add_action( 'admin_enqueue_scripts', array( $this, 'dlthumbs_admin_scripts' ) ); 
     38         
     39        $dir = wp_upload_dir(); 
     40        $this->dir = $dir['basedir']; 
     41        $this->url = $dir['baseurl']; 
     42         
     43        // get the media library for comparison 
     44        $library = array(); 
     45        $args = array(       
     46            'post_type' => 'attachment', 
     47            'post_mime_type' => 'image', 
     48            'numberposts' => -1, 
     49            'post_status' => null, 
     50            'post_parent' => null, // any parent 
     51        ); 
     52        $attachments = get_posts($args); 
     53        foreach ($attachments as $post) { 
     54            $library[] = $this->fixslash(wp_get_attachment_url($post->ID)); 
     55        } 
     56         
     57        $this->library = $library; 
     58 
     59    } 
     60 
     61    /** 
     62     * Add Menu Page 
     63     * 
     64     * @since 2.0 
     65     */ 
     66    public function add_admin_menu() { 
     67        $this->menu_id = add_management_page( __( 'Delete Thumbnails', 'dlthumbs' ), __( 'Delete Thumbnails', 'dlthumbs' ), 'administrator', 'dlthumbs', array($this, 'dlthumbs_interface') ); 
     68    } 
     69     
     70    /** 
     71     * Add Resources 
     72     * 
     73     * @since 2.0 
     74     */ 
     75    function dlthumbs_admin_scripts() { 
     76        if (get_current_screen()->base == 'tools_page_dlthumbs') { 
     77            wp_register_style( 'dlthumbs_css', plugins_url('style.css', __FILE__), false, '2.0' ); 
     78            wp_enqueue_style( 'dlthumbs_css' ); 
     79 
     80            wp_register_script( 'dlthumbs_js', plugins_url('dltumbs.js', __FILE__), array('jquery'), '2.0', true ); 
     81            wp_enqueue_script( 'dlthumbs_js' ); 
     82        } 
     83    } 
     84 
     85    /** 
     86     * HTML Page 
     87     * 
     88     * @since 2.0 
     89     */ 
     90    function dlthumbs_interface() {      
     91        ?> 
     92        <div class='wrap' id='dlthumbs'>  
     93            <h2><?php _e('Delete Resized Images','dlthumbs') ?></h2> 
     94             
     95            <?php                
     96            // load files in media upload dir 
     97            $this->files = $this->get_files_from_folder(array(),$this->dir); 
     98            $this->numberOfFiles = count($this->files); 
     99             
     100            // check the dir for permissions 
     101            $chmod = substr(sprintf('%o', fileperms($this->dir)), -4); 
     102            if ($chmod < 755) : ?> 
     103            <div class="notice notice-error"><p> 
     104                <?php _e("This plugin requires Your upload directory CHMOD to be at least <code>755</code> so PHP can edit it. The deletion of files will most likely not work. Please contact your host or website provider for assistance. Mention your CHMOD is currently set to:",'dlthumbs') ?> <code><?php echo $chmod ?></code> 
     105                 
     106            </p></div> 
     107            <?php endif; 
     108 
     109             
     110            // Form submit, run deletion 
     111            $this->dltthumbs_form_submit(); 
     112             
     113            // show thumbnails 
     114            $this->dltthumbs_list_form(); 
     115            ?> 
     116          </div>     
     117          <?php 
     118    } 
     119     
     120    /** 
     121     * Form Submit Actions 
     122     * 
     123     * @since 2.0 
     124     */ 
     125    function dltthumbs_form_submit() { 
     126        if ( isset($_POST['dlthumbs_list']) && !empty($_POST['dlthumbs_list']) && $_POST['dlthumbs_list'] != '[]' ) { 
     127             
     128            if (check_admin_referer( 'dlthumbs_submit')) { 
     129                $deleted = $notDeleted = array(); 
     130                $filestodelete = json_decode(str_replace('\"','"',$_POST['dlthumbs_list'])); 
     131                foreach ($filestodelete as $deleteme) { 
     132                    if (unlink($this->dir.$deleteme)) 
     133                        $deleted[] = $this->dir.$deleteme; 
     134                    else 
     135                        $notDeleted[] = $deleteme; 
     136                } 
     137                 
     138                if (count($deleted) > 0) { 
     139                    ?> 
     140                <div class="notice notice-success is-dismissible"><p> 
     141                    <?php echo count($deleted) ?> <?php _e('files successfully deleted.','dlthumbs') ?> 
     142                </p></div> 
     143                    <? 
     144                } 
     145                if (count($notDeleted) > 0) { 
     146                    ?> 
     147                <div class="notice notice-error"><p> 
     148                    <?php _e('Yikes.','dlthumbs') ?>  
     149                    <?php echo count($notDeleted) ?>   
     150                    <?php _e('files were marked to-delete but PHP was unable to delete them.','dlthumbs') ?> 
     151                    <?php 
     152                    echo implode('<br /> - ', $notDeleted); 
     153                    ?> 
     154                </p></div> 
     155                    <?php 
     156                } 
     157                 
     158            } else { 
     159                ?> 
     160                <div class="notice notice-error"><p> 
     161                    <?php _e('Something went wrong with the','dlthumbs') ?>  
     162                    <code>wp_nonce_field()</code>. 
     163                </p></div> 
     164                <?php 
     165            } 
     166             
     167        } 
     168    } 
     169      
     170    /** 
     171     * List all files from uploads directory 
     172     * 
     173     * @since 2.0 
     174     */ 
     175    function dltthumbs_list_form() { 
     176        ?> 
     177        <div class="notice notice-<?php echo ($this->numberOfFiles == 0) ? 'error' : 'info' ?>"><p> 
     178        <?php _e('Browsing','dlthumbs') ?>: <code>/<?php echo str_replace(get_home_path(),'',$this->dir) ?>/</code>  
     179        <?php echo $this->numberOfFiles ?> <?php _e('files were found','dlthumbs') ?> <?php if ($this->numberOfFiles > 0) {  
     180            ?>, <span class='total_thumbnail_count'></span> <?php _e('images detected as resized images','dlthumbs') ?>. 
     181        <?php } ?> 
     182        </p></div> 
     183         
     184        <table class='widefat'> 
     185            <thead> 
     186                <tr> 
     187                    <th> 
     188                        <input type='checkbox' name='selectall' title='Select All' /> 
     189                    </th> 
     190                    <th> 
     191                        <?php _e('Preview','dlthumbs') ?> 
     192                    </th> 
     193                    <th> 
     194                        <?php _e('File','dlthumbs') ?> 
     195                    </th> 
     196                </tr> 
     197            </thead> 
     198            <tbody> 
     199                <?php  
     200                    $id = 0; 
     201                    foreach ($this->files as $afile) { 
     202                        $isThumb = $this->dlthumbs_is_thumbnail($afile); //($afile[1]) ? true : false; 
     203                        $file = $afile;//$afile[0]; 
     204                        if (!$isThumb) continue; 
     205                        $id++; 
     206                        ?> 
     207                        <tr> 
     208                            <td> 
     209                                &nbsp;<input id='input-<?php echo $id ?>' type='checkbox' value='<?php echo str_replace($this->dir,'',$file) ?>' />  
     210                            </td> 
     211                            <td> 
     212                                <a target='_Blank' href='<?php echo $this->fixslash(str_replace($this->dir,$this->url,$file)) ?>'>View »</a>  
     213                            </td> 
     214                            <td> 
     215                                <label for='input-<?php echo $id ?>'> 
     216                                    <?php echo str_replace($this->dir,'',$file) ?> 
     217                                </label> 
     218                            </td> 
     219                        </tr> 
     220                        <?php 
     221                    } 
     222                    if ($id == 0 || $this->numberOfFiles == 0) { 
     223                        ?> 
     224                        <tr> 
     225                            <td colspan=3> 
     226                                <p id='wtfnofiles'><?php _e('No resized images found in','dlthumbs') ?>:<br /> 
     227                                <code><?php echo $this->dir ?></code> 
     228                                </p> 
     229                            </td> 
     230                        </tr> 
     231                        <? 
     232                    } 
     233                ?> 
     234            </tbody> 
     235        </table>     
     236         
     237        <br /> 
     238 
     239        <form action="" method="POST"> 
     240            <?php 
     241            // security 
     242            wp_nonce_field( 'dlthumbs_submit'); 
     243            if ($id != 0 && $this->numberOfFiles != 0) { 
     244            ?> 
     245             
     246            <!-- the magic --> 
     247            <textarea name='dlthumbs_list'></textarea> 
     248            <p> 
     249                <label> 
     250                    <input class='nag' value='' type='checkbox' name='nag1' />  
     251                    <?php _e('I understand that pressing the button below will delete the above selected files','dlthumbs') ?>. 
     252                </label> 
     253                <br /> 
     254                <label> 
     255                    <input class='nag' value='' type='checkbox' name='nag2' />  
     256                    <?php _e('I have backed up the uploads directory before doing this','dlthumbs') ?> (<code>/<?php echo str_replace(get_home_path(),'',$this->dir) ?>/</code>). 
     257                </label> 
     258                <br /> 
     259                <label> 
     260                    <input class='nag' value='' type='checkbox' name='nag3' />  
     261                    <?php _e('I understand this action can not be undone','dlthumbs') ?>.</label><br /> 
     262            </p> 
     263            <input type='submit' class='button-primary button-large button' value='<?php _e('DELETE THUMBNAILS','dlthumbs') ?> &raquo;' disabled> 
     264            <?php } ?> 
     265        </form> 
     266         
     267        <p id='streetcred'><?php _e('Plugin By','dlthumbs') ?> <a href='https://davidsword.ca/' target='_Blank'>David Sword</a></p> 
     268        <? 
     269    } 
     270     
     271    /** 
     272     * function for indexing directory 
     273     * 
     274     * using itself from within to get sub-folder's indexed 
     275     * also used to delete thumbnails as indexing when instructed to 
     276     * 
     277     * @since 2.0 
     278     */  
     279    function get_files_from_folder($files = '',$folder,$godeep = true) {         
     280        if (empty($files)) $files = array(); 
     281         
     282        // start read 
     283        if (is_dir($folder)) { 
     284            $dh  = opendir($folder); 
     285            while (false !== ($filename = readdir($dh))) { 
     286                if (!in_array($filename, array('.DS_Store','.','..',''))) { 
     287     
     288                    // it's a dir, index contents w/ current function 
     289                    if ($this->dlthumbs_check_if_dir($filename)) { 
     290                        // repeat same function, find files within folders, 
     291                        $subfiles = $this->get_files_from_folder(array(),$this->fixslash($folder.'/'.$filename.'/'),false); 
     292                        foreach ($subfiles as $subfile) 
     293                            $files[] = $subfile; 
     294 
     295                    // it's a file 
    181296                    } else { 
    182                         $prefix = "[ ] "; 
     297                        $files[] = $this->fixslash($folder.'/'.$filename); 
    183298                    } 
    184                      
    185                     // output file name 
    186                     $files[] = "{$prefix}<span class='{$thumbnailfound}' style='{$style}'>".$dir.$dirfile."</span>"; 
    187299                } 
    188300            } 
    189301        } 
    190     } 
    191     return $files; 
     302        return $files; 
     303    } 
     304     
     305    /** 
     306     * Determine if a file is a thumbnail or not 
     307     * 
     308     * @since 2.0 
     309     */  
     310    function dlthumbs_is_thumbnail($file) { 
     311        // if it's in the media library as a main file, it's defnitantly not a thumbnail 
     312        // it could of been mistaken as one if it's source was a downloaded thumbnail from  
     313        // another Wordpress blog 
     314        if (in_array(str_replace(get_home_path(),'',$file), $this->library)) { 
     315            return false; 
     316        } 
     317         
     318        // if it has the thumbnail suffix, lets concider it 
     319        preg_match('"-([0-9]*x[0-9]*)."', $file, $matches); 
     320        if (count($matches) > 0) { 
     321            // wordpress thumbnails will generate with `quality = 82` in comments 
     322            // if it has that, it's for sure a thumbnail 
     323            $headers = @exif_read_data($file); 
     324            $comment = (is_array($headers) && isset($headers['COMMENT'])) ? $headers['COMMENT'][0] : false; 
     325            if ($comment) { 
     326                $pos = strpos($comment, 'quality = 82'); 
     327                return ($pos === false) ? false : true; 
     328            } 
     329        } 
     330         
     331        // not sure what it is, just send it back as not a thumbnail 
     332        return false; 
     333    } 
     334         
     335    /** 
     336     * check if item is a dir or file 
     337     * 
     338     * find out if the current item in dir is another dir a hidden file, or an actual file 
     339     * 
     340     * @since 2.0 
     341     */  
     342    function dlthumbs_check_if_dir($filename) { 
     343        $pos = strpos($filename, '.'); 
     344        if ($pos === false) { 
     345            return true; 
     346        } else { 
     347            return false; 
     348        } 
     349    } 
     350 
     351    /** 
     352     * helper, replace double slash 
     353     * 
     354     * @since 2.0 
     355     */  
     356    function fixslash($str) { 
     357        return str_replace('//','/',$str); 
     358    } 
     359     
    192360} 
    193  
    194  
    195 // main function for detecting if  
    196 // the delete button/action has been pressed 
    197 function dlthumbs_were_deleting() { 
    198     return ( isset($_GET['delete']) && $_GET['delete'] == 'YES_SIR' ) ? true : false; 
    199 } 
    200  
    201  
    202 // basic regex to find wordpress thumbnails  
    203 // looks for: "-###x###." pattern 
    204 function is_thumbnail($str) { 
    205     $re = '"-([0-9]*x[0-9]*)."'; 
    206     preg_match($re, $str, $matches); 
    207     if (count($matches) > 0) { 
    208         return true; 
    209     } 
    210     return false; 
    211 } 
    212  
    213  
    214 // find out if the current item in dir is another dir,  
    215 // a hidden file, or an actual file 
    216 function check_if_dir($filename) { 
    217     $pos = strpos($filename, '.'); 
    218     if ($pos === false) { 
    219         return true; 
    220     } else { 
    221         return false; 
    222     } 
    223 } 
    224  
    225361?> 
  • delete-thumbnails/trunk/readme.txt

    r1021577 r1685851  
    11=== Delete Thumbnails === 
    22Contributors: davidsword 
    3 Donate link: http://handsomefox.com/donate/ 
    4 Tags: delete, thumbnails, media, images, library, thumbnail 
     3Donate link: http://www.redcross.ca/donate/ 
     4Tags: delete, thumbnails, media, images, library, resized, delete sizes, image sizes, remove images, clean uploads, clean file sizes 
    55Requires at least: 3.0 
    6 Tested up to: 4.0 
    7 Stable tag: 1.0 
     6Tested up to: 4.8 
     7Stable tag: 2.0 
    88 
    9 Find and delete all thumbnails from your Media Library 
     9Find and delete thumbnails & resized images from your Media Library 
     10 
    1011 
    1112== Description == 
    1213 
    13 Use this plugin to delete ALL thumbnails from your Media Library. This is useful if your site and plugins have changed many times over the past years and accumulated a vast number of thumbnails that are no longer needed. 
     14Use this plugin to delete some or all of Wordpress resized images (thumbnails, medium, large, and extra ones Plugins and Themes secretly made) from your Media Library. This can clear thousands of unwanted files. This is useful if your site and plugins have changed many times over the past years and accumulated a vast number of thumbnails that are no longer needed. 
    1415 
    15 1. When deleting, thumbnails are deleted at a code level and will be deleted premaritally 
    16 1. You can use [this plugin](http://wordpress.org/plugins/regenerate-thumbnails/) to regenerate your thumbnails if needed 
    17 1. All files that will be deleted are marked with `[X]` and highlighted in red  
    18 1. Press the **delete all thumbnails** button at the bottom of the page to delete thumbnails 
     161. When deleting, thumbnails are deleted at a code level using PHPs `unlink()` function and *will be deleted permanently* 
     171. You can use [this plugin](http://wordpress.org/plugins/regenerate-thumbnails/) to regenerate your thumbnails after as Wordpress will need the basic ones 
     18 
    1919 
    2020== Installation == 
    2121 
    22 1. Download the plugin and extract the files 
    23 1. Upload `delete-thumbnails` to your `~/wp-content/plugins/` directory 
     221. Install the plugin from your Plugin browser, or download the plugin and extract the files and upload `delete-thumbnails` to your `/wp-content/plugins/` directory 
    24231. Activate the plugin through the 'Plugins' menu in WordPress 
    25 1. View the Delete Thumbnails settings (located under the main Settings menu in the WordPress admin) 
     241. View the *Delete Thumbnails* interface under *Tools* in your Wordpress Admin 
     25 
    2626 
    2727== Frequently Asked Questions == 
    2828 
     29= What Parameters are used to determine if a file is a thumbnail = 
     30 
     31After looking at all files in the Wordpress Upload Directory, the plugin concludes a file to be a thumbnail when 3 criteria are all meet: 
     32 
     331. It's an image  
     341. The filename returns a regex match `/-([0-9]*x[0-9]*)./` 
     351. The header of the file (hidden info) contains Wordpress's default image quality comment with a value 82 
     361. The file URL is not a Wordpress Media Library parent item 
     37 
    2938= What is this warning about `chmod` about? = 
    3039 
    31 Your wordpress installation has very secure server settings. This basically means that the code cannot change things on the server, so the code of this plugin cannot delete the thumbnails without a minor modification of the server. 
     40Your wordpress installation has secure server settings. This basically means that the code cannot change things on the server, so the code of this plugin cannot delete the thumbnails without a minor modification of the server. 
    3241 
    33 = What Does "Registered:" Mean = 
     42= It says I have no resized images, but I do = 
    3443 
    35 "Registered" and proceeding list are Wordpress's registered image thumbnail sizes. These sizes are set via `wp-admin > Settings > Media`. If there's more than three, a plugin or a theme has used [add_image_size()](codex.wordpress.org/Function_Reference/add_image_size) to add a custom size. 
     44This is a new plugin, please contact me via Support tab and start a request providing as much info as you're willing to give. This plugin was developed on 2 server environments, yours may of not been considered while developing. 
     45 
     46= How do I backup my files? = 
     47 
     48The plugin insists on backups, you can ignore and bypass, however files are permanently deleted, always [backup your Wordpress installation](https://codex.wordpress.org/WordPress_Backups#Backing_Up_Your_WordPress_Site) 
    3649 
    3750== Screenshots == 
    3851 
    39 1. Simple text interface to indentify all your thumbnails, showing you exactly what you will be deleting 
     521. List of all thumbnails with option to delete 
     53 
    4054 
    4155== Changelog == 
     56 
     57= 2.0 = 
     58* June 25, 2017 
     59* Project revival  
     60* Code overhaul/rewrite 
     61* Added better assets 
     62* Much cleaner and Wordpress native looking interface, no more code-line look 
     63* Readme, UI, and inline documentation corrected and improved 
     64* Improved logic of deletion 
     65* Improved logic for form submission with low `max_input_vars` values in mind 
     66* better detection of thumbnails & cross checking media library attachments 
    4267 
    4368= 1.0 = 
     
    4671 
    4772= 0.1 = 
    48 * July 6th, 2014 
     73* July 6, 2014 
    4974* Initial Build, private use 
     75 
     76 
     77== Upgrade Notice == 
     78 
     79= 2.0 = 
     80* all clear, blue sky 
     81 
     82= 1.0 = 
     83* all clear, blue sky 
     84 
     85 
     86== Road Map == 
     87 
     88The current todo list.  
     89 
     90* Nothing yet! Please add any additional requests into the Support tab. 
Note: See TracChangeset for help on using the changeset viewer.