Search the Community
Showing results for tags 'Image Variations'.
-
Currently my system is using nginx server on production recently upgraded from processwire 2.5 to processwire 2.7.2 We are making multiple dimension sizes of images. On our system it is taking very less time locally on apache server. Tested this on another system it work fine there, even tested on nginx locally. Issue arises when we deploy it to server , the performance goes slow and hence it is taking more than normal time. if an image locally take 2 seconds for variations on server same image take almost 50s to 1 min(excluding uploading time). Here is a code for creating image variations. <?php class ImageCreateThumbs extends WireData implements Module { public static function getModuleInfo() { return array( 'title' => 'ImageCreateThumbs', 'version' => 100, 'summary' => 'This module allows creation of multiple sized images.', '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' && $inputfield->name != 'image' && $inputfield->name != 'asset_image') return; // we assume images field $image = $event->argumentsByName("pagefile"); $image->size(350,0); $image->size(480,0); $image->size(560,0); $image->size(680,0); $image->size(760,0); $image->size(840,0); $image->size(960,0); $image->size(1200,0); $image->size(1400,0); $image->size(1500,0); $image->size(1900,0); $image->size(2000,0); $image->size(2400,0); } }
- 2 replies
-
- ImageSizer
- Thumbs
-
(and 1 more)
Tagged with:
-
I have an issue where I want to have an image resized, but have both a cropped and non-cropped version available (of the same size!) The code to do this is simple: $imagefull = $image->size(320,320,array( 'cropping' => false); $imagecropped = $image->size(320,320,array( 'cropping' => true); However, this only creates ONE variant of the image: eg. imagename.320x320.jpg So the same image is shown twice in the output page, instead of the two options Can anyone suggest a clean way of doing this? (ie. not duplicating every base image) Is there a way of creating named Image Variations? And do these names go into the filename to guarantee uniqueness? eg. $image->addVariation($name,$size,$options) or similar Thanks
- 2 replies
-
- images
- image variations
-
(and 4 more)
Tagged with: