Posted in
13449
7:07 am, April 11, 2023
error Warning: getimagesize(uploads/583517f49099a.jpg): failed to open stream: No such file or directory in SimpleImage.php on line 1198
i think this error is just caused by a missing file. But there should be some kind of error checking here to not crash the whole site just due to a missing image file.
this error is quite hard to find where its actually coming from as its within a library file on another page so it does not really tell where the error is coming from.
PHP
Warning: getimagesize(uploads/583517f49099a.jpg): failed to open stream: No such file or directory in /var/www/html/clash-royale.mmmos.com/lib/SimpleImage.php on line 1198
Notice: Trying to access array offset on value of type bool in /var/www/html/clash-royale.mmmos.com/lib/SimpleImage.php on line 1200
Fatal error: Uncaught Exception: Invalid image: uploads/583517f49099a.jpg in /var/www/html/clash-royale.mmmos.com/lib/SimpleImage.php:1211 Stack trace: #0 /var/www/html/clash-royale.mmmos.com/lib/SimpleImage.php(539): bones\SimpleImage->get_meta_data() #1 /var/www/html/clash-royale.mmmos.com/lib/SimpleImage.php(47): bones\SimpleImage->load() #2 /var/www/html/clash-royale.mmmos.com/class/content.class.php(1144): bones\SimpleImage->__construct() #3 /var/www/html/clash-royale.mmmos.com/pages/view.page.php(530): content->also_like() #4 /var/www/html/clash-royale.mmmos.com/page.php(47): include('/var/www/html/c...') #5 /var/www/html/clash-royale.mmmos.com/index.php(3): require_once('/var/www/html/c...') #6 {main} thrown in /var/www/html/clash-royale.mmmos.com/lib/SimpleImage.php on line 1211
I guess first ill check if the image does exist.
Nope the image does not, but its weird that passing an invalid file crashes the whole page.
HTML
https://clash-royale.mmmos.com/?p=/view/1067/android-game-stuck-on-loading-at-50-for-many-players/
it seems this is causing the error
content.class line 144
PHP
$img = new bones\SimpleImage($local_file);
so should just add a check for the $local_file existing before running it through simple image and that should fix it.
PHP
if(file_exists($local_file)) {
include_once("lib/SimpleImage.php");
$img = new bones\SimpleImage($local_file);
$img->thumbnail(165, 165)->save($thumbnail, 70);
} else {
$thumbnail = "";
}
check if the file exists and if it does not set the thumbnail to blank or a placeholder probably.
View Statistics
This Week
362
This Month
901
This Year
3966
Add Comment
Other Items in php errors
Related Search Terms
Other Categories in Code
alpine js apps c css factorio font awesome images linux quick modals sqlite site bugs site updates slick slider sliders testing windows apps apache api apps asp bat bootstrap bootstrap templates charts cookies core css css filters css grid design elements docker domains emoji fancybox fonts foundation framework gimp git html icons ideas image formatting images javascript javascript functions jquery js linux mac misc modals mysql nginx node php php errors php function php functions php simple html dom pi400 python react regex sections simple_html_dom simplepie php site bugs site documentation slick slider sql sqlite ssh sublime svg svg css templates tools virtual box vscode vue webdev windows windows 11 windows commands wordpress