Go Back   Mosets Community > Mosets Announcements and Discussions > Mosets & Joomla

Thread Tools Search this Thread Display Modes
Old 06-06-2018, 10:42 AM
peterwalker peterwalker is offline
Join Date: Nov 2013
Posts: 53
Default Empty the original images directory with a single click in admin

The original images directory uses up much of a site's hosting space and most times those images are never used. It becomes a problem when on a hosting service that limits by files. In some cases that directory will exceed by the gigabyte, especially if you add photo galleries per entry.

A client had such a situation and he was told to upgrade his hosting or dump some files. The original images directory had over 13k files and was over 9gigs. The plugin made the dump within a second. It has an indicator to show image count in the directory.

Here is the basis of the code if you wish to create the plugin.
PHP Code:
public function onAfterDispatch() 
$this->app->isAdmin() && $this->component == 'com_mtree' 
$originals JPATH_ROOT.$mtconf->get('relative_path_to_listing_original_image');
// empty original images folder - super admin only
if( $this->sadmin 
        if( !
is_null($this->input->post->get('deleteoriginal')) ) {
JFolder::delete(substr($originals,0,-1), true);
$this->app->enqueueMessage(JText::_('Successfully emptied original images'));
// get total images in original directory
$imgs count(glob($originals '*.{jpg,jpeg,png,gif}'GLOB_BRACE));
$html[] = '<form class="cmseform" action="" method="post">
                    <button type="submit" name="deleteoriginal" class="btn btn-small addmenu hasTooltip" title="Use this button to empty the original images directory to free server space. Use only if your directory does not use the original images">Empty Original Images ('
Attached Images
File Type: jpg 2018-06-05 22_20_55.jpg (8.1 KB, 11 views)
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
If email address is empty, admin one is used? chrisclay Discussions, Troubleshooting & Problems 2 09-20-2014 09:51 AM
when i click on a directory listing i am taken to DTRegister joomla extension woonydanny Discussions, Troubleshooting & Problems 4 01-10-2013 05:30 PM

All times are GMT +8. The time now is 03:18 PM.

Copyright © 2005-2010 Mosets Consulting

Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.