create thumbs when uploading image
<?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 != 'images') return; | |
$image = $event->argumentsByName("pagefile"); | |
$image->size(120,120); | |
$image->size(1000,0); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment