My client is saturating the server capacity with tons of images, the images are resized but the original still on the server. How can I use the resized images and delete the original?
I use the following module created by @soma:
The post here
<?php
class ImageCreateThumbs extends WireData implements Module {
public static function getModuleInfo() {
return array(
'title' => 'ImageCreateThumbs',
'version' => 100,
'summary' => '',
'href' => '',
'singular' => true,
'autoload' => true
);
}
public function init() {
$this->addHookAfter('InputfieldFile::fileAdded', $this, 'sizeImage');
}
public function sizeImage($event) {
$inputfield = $event->object;
if($inputfield->name != 'prop_imagen') return; // we assume images field
$image = $event->argumentsByName("pagefile");
$image->size(120,120);
$image->size(1000,0);
}
}
Thank you in advance.