Usman Posted May 5, 2016 Share Posted May 5, 2016 (edited) Currently my system is using nginx server on production recently upgraded from processwire 2.5 to processwire 2.7.2We 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); } } Edited May 5, 2016 by LostKobrakai Added codeblock Link to comment Share on other sites More sharing options...
LostKobrakai Posted May 5, 2016 Share Posted May 5, 2016 Are you sure the server does actually have an equivalent amount of horsepower available compared to your computer? Image resizing is highly cpu intensive and therefore dependent on the servers hardware. 1 Link to comment Share on other sites More sharing options...
horst Posted May 5, 2016 Share Posted May 5, 2016 If you are able to do, I would suggest to create a simple testsite with latest PW 3.0.16 and enable the IMagick ImageSizerExtension. Would be interesting to compare the time on the exact same server. 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now