It seems that an issue that was solved in craftcms 2.6.2991 is reintroduced afterwards. I have just updated a site to version 2.6.2997 and the exactly the same error that was there prior to version 2.6.2991 is reappearing again on php 7.x environments
"A non-numeric value encountered" /var/www/vhosts/xxx/httpdocs/etc/plugins/imager/services/ImagerService.php(1025)
1013 * @param $transform
1014 * @return \Imagine\Image\Point
1015 */
1016 private function _getCropPoint($resizeSize, $cropSize, $transform)
1017 {
1018 // get default crop position from the settings
1019 $position = $this->getSetting('position', $transform);
1020
1021 // get the offsets, left and top, now as an int, representing the % offset
1022 list($leftOffset, $topOffset) = explode(' ', $position);
1023
1024 // get position that crop should center around
1025 $leftPos = floor($resizeSize->getWidth() * ($leftOffset / 100)) - floor($cropSize->getWidth()/2);
1026 $topPos = floor($resizeSize->getHeight() * ($topOffset / 100)) - floor($cropSize->getHeight()/2);
1027
1028 // make sure the point is within the boundaries and return the point
1029 return new \Imagine\Image\Point(
1030 min(max($leftPos, 0), ($resizeSize->getWidth() - $cropSize->getWidth())),
1031 min(max($topPos, 0), ($resizeSize->getHeight() - $cropSize->getHeight()))
1032 );
1033 }
1034
1035
1036 /**
1037 * Returns the filter method for resize operations
Stack Trace
- 0
– /var/www/vhosts/xxx/httpdocs/etc/app/etc/web/WebApp.php(693): CApplication->handleError(2, "A non-numeric value encountered", "/var/www/vhosts//httpdocs/etc/plugins/imager/s...", 1025)
688 if (version_compare(PHP_VERSION, '7.1', '>=') && strpos($message, 'Narrowing occurred during type inference. Please file a bug report') !== false)
689 {
690 return;
691 }
692
693 parent::handleError($code, $message, $file, $line);
694 }
695
696 // Private Methods
697 // =========================================================================
698
- 1
– /var/www/vhosts/xxx/httpdocs/etc/plugins/imager/services/ImagerService.php(1025): Craft\WebApp->handleError(2, "A non-numeric value encountered", "/var/www/vhosts/xxx/httpdocs/etc/plugins/imager/s...", 1025, ...)
1020
1021 // get the offsets, left and top, now as an int, representing the % offset
1022 list($leftOffset, $topOffset) = explode(' ', $position);
1023
1024 // get position that crop should center around
1025 $leftPos = floor($resizeSize->getWidth() * ($leftOffset / 100)) - floor($cropSize->getWidth()/2);
1026 $topPos = floor($resizeSize->getHeight() * ($topOffset / 100)) - floor($cropSize->getHeight()/2);
1027
1028 // make sure the point is within the boundaries and return the point
1029 return new \Imagine\Image\Point(
1030 min(max($leftPos, 0), ($resizeSize->getWidth() - $cropSize->getWidth())),
- 2
– /var/www/vhosts/xxx/httpdocs/etc/plugins/imager/services/ImagerService.php(635): Craft\ImagerService->_getCropPoint(Imagine\Image\Box, Imagine\Image\Box, array("width" => 1200, "height" => 600, "mode" => "crop", "allowUpscale" => false, ...))
630 $layer->resize($resizeSize, $filterMethod);
631 }
632
633 // Do the crop
634 if (!isset($transform['mode']) || mb_strtolower($transform['mode']) === 'crop' || mb_strtolower($transform['mode']) === 'croponly') {
635 $cropPoint = $this->_getCropPoint($resizeSize, $cropSize, $transform);
636 $layer->crop($cropPoint, $cropSize);
637 }
638
639 // letterbox, add padding
640 if (isset($transform['mode']) && mb_strtolower($transform['mode']) === 'letterbox') {
- 3
– /var/www/vhosts/xxx/httpdocs/etc/plugins/imager/services/ImagerService.php(523): Craft\ImagerService->_transformLayer(Imagine\Imagick\Image, array("width" => 1200, "height" => 600, "mode" => "crop", "allowUpscale" => false, ...), "jpg", "jpg")
518 }
519
520 $this->imageInstance = $gif;
521
522 } else {
523 $this->_transformLayer($this->imageInstance, $transform, $sourceExtension, $targetExtension);
524 }
525
526 // If Image Driver is imagick and removeMetadata is true, remove meta data
527 if ($this->imageDriver === 'imagick' && $this->getSetting('removeMetadata', $transform)) {
528 $this->imageInstance->strip();
- 6
– /var/www/vhosts/xxx/httpdocs/etc/plugins/imager/services/ImagerService.php(341): Craft\ImagerService->_getTransformedImage(Craft\Imager_ImagePathsModel, array("width" => 1200, "height" => 600, "mode" => "crop", "allowUpscale" => false, ...))
336 $r = null;
337
338 if (isset($transform[0])) {
339 $transformedImages = array();
340 foreach ($transform as $t) {
341 $transformedImage = $this->_getTransformedImage($pathsModel, $transformDefaults != null ? array_merge($transformDefaults, $t) : $t);
342 $transformedImages[] = $transformedImage;
343 }
344 $r = $transformedImages;
345 } else {
346 $transformedImage = $this->_getTransformedImage($pathsModel, $transformDefaults != null ? array_merge($transformDefaults, (array)$transform) : $transform);
- 5
– /var/www/vhosts/xxx/httpdocs/etc/plugins/imager/variables/ImagerVariable.php(26): Craft\ImagerService->transformImage(Craft\AssetFileModel, array(array("width" => 1200, "ratio" => 2), array("width" => 1024, "ratio" => 2), array("width" => 768, "ratio" => 1.3333333333333, "jpegQuality" => 65)), array("format" => "jpg", "allowUpscale" => false, "mode" => "crop", "jpegQuality" => 80, ...), null)
21 * @param $configOverrides
22 * @return mixed
23 */
24 public function transformImage($file, $transform, $transformDefaults = null, $configOverrides = null)
25 {
26 $image = craft()->imager->transformImage($file, $transform, $transformDefaults, $configOverrides);
27 return $image;
28 }
29
30 /**
31 * Takes an array of Imager_ImageModel (or anything else that supports getUrl() and getWidth())
...
...