Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About Usman

  • Rank
  1. 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); } }
  • Create New...