How to use getImageSize() using cakephp

I have a code to show an image and specific attributes like its width and height

echo $this->Html->image('../upload/industries/'.$cooperation->industry->logo, ['style' => 'max-width:100%;max-height:100%']);
                                    
list($width, $height, $type, $attr) = getimagesize("../upload/industries/".$cooperation->industry->logo);
echo $width."-".$height ;

The path value in getImageSize() is not working in my code, Please help me to solve it
thank you

I think the error you are facing is the ../

try using the full-path (e.g. var/www/html/image/image.png) or WWW_ROOT constant.

1 Like

Thank you, it works using :
$imagePath = WWW_ROOT . ‘upload’ . DS . ‘industries’ . DS . $cooperation->industry->logo;