Thumbnail Cropping

Permalink
This code used to work in PHP 5.6 but when I upgraded to PHP7.1 yesterday, this code isn't working anymore
$ih = Loader::helper('image');
$thumb = $ih->getThumbnail($thumbnail, 185, 139, true);
echo '<img src="' . $thumb->src . '" />

I read that the image helper is deprecated, so is there another option that has the same effect? I mean the cropping.

 
hutman replied on at Permalink Reply
hutman
This is basically the same.

$im = $app->make('helper/image');
$thumb = $im->getThumbnail($f, $maxWidth, $maxHeight, $cropImage);
rempelmd replied on at Permalink Reply
I tried that but the same thing actually, the images are stil not showing.
$im = Core::make('helper/image');
$thumb = $im->getThumbnail($thumbnail, 180, 120, true);
echo '<img src="' . $thumb->src . '" />';
hutman replied on at Permalink Reply
hutman
This works in 8.3.2 (the code came from the core image block). What is your $thumbnail and what version are you using?
ramonleenders replied on at Permalink Reply
ramonleenders
Some checks on if you have an object (probably on both variables) would prevent errors from showing. Could be that the system can't create the thumbnail (in /application/files - due to rights or space even) and/or the file you're passing isn't found.