cancel
Showing results for 
Search instead for 
Did you mean: 

Magento 2 Error filtering template: Warning: filesize ()

Magento 2 Error filtering template: Warning: filesize ()

Error filtering template: Warning: filesize(): stat failed for http://localhost/jaipurbkp/pub/media/catalog/product/s/c/screen_shot_2020-10-03_at_2.37.35_pm.png in C:\wamp64\www\jdrbkp\vendor\magento\framework\Image\Adapter\Gd2.php on line 63

1 REPLY 1

Re: Magento 2 Error filtering template: Warning: filesize ()

Hi @desktop1 

 

Please review the updated code below:

$albumCoverImg = '/home/link/public_html/cdcovers/' . $row['album'] . '.jpg';

$minSize   = 5 * 1000; // 5KB
$fileExist = is_file($albumCoverImg);

if (!$fileExist || ($fileExist && filesize($albumCoverImg) < $minSize)) {
    //gravar as imagens
    $imageString = file_get_contents(LastFMArtwork::getArtwork($row['artist'], $row['album'], true, "large"));
    $save        = file_put_contents($albumCoverImg, $imageString);
}

 It may help you!
Problem Solved? Please click on 'Kudos' & Accept as Solution!

Problem solved? Click Accept as Solution!