Posted in php errors
13581
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
227
This Month
1033
This Year
4098

No Items Found.

Add Comment
Type in a Nick Name here
 
Related Search Terms
Search Code
Search Code by entering your search text above.
Welcome

This is my test area for webdev. I keep a collection of code here, mostly for my reference. Also if i find a good link, i usually add it here and then forget about it. more...

Subscribe to weekly updates about things i have added to the site or thought interesting during the last week.

You could also follow me on twitter or not... does anyone even use twitter anymore?

If you found something useful or like my work, you can buy me a coffee here. Mmm Coffee. ☕

❤️👩‍💻🎮

🪦 2000 - 16 Oct 2022 - Boots
Random Quote

"Olivia, my eldest daughter, caught measles when she was seven years old. As the illness took its usual course I can remember reading to her often in bed and not feeling particularly alarmed about it. Then one morning, when she was well on the road to recovery, I was sitting on her bed showing her how to fashion little animals out of coloured pipe-cleaners, and when it came to her turn to make one herself, I noticed that her fingers and her mind were not working together and she couldn’t do anything. 'Are you feeling all right?' I asked her. 'I feel all sleepy,' she said. In an hour, she was unconscious. In twelve hours she was dead. The measles had turned into a terrible thing called measles encephalitis and there was nothing the doctors could do to save her. That was...in 1962, but even now, if a child with measles happens to develop the same deadly reaction from measles as Olivia did, there would still be nothing the doctors could do to help her. On the other hand, there is today something that parents can do to make sure that this sort of tragedy does not happen to a child of theirs. They can insist that their child is immunised against measles. ...I dedicated two of my books to Olivia, the first was ‘James and the Giant Peach’. That was when she was still alive. The second was ‘The BFG’, dedicated to her memory after she had died from measles. You will see her name at the beginning of each of these books. And I know how happy she would be if only she could know that her death had helped to save a good deal of illness and death among other children."

I just checked google books for BFG, and the dedication is there. 

https://www.google.com.au/books/edition/_/quybcXrFhCIC?hl=en&gbpv=1 


Roald Dahl, 1986
Random CSS Property

<flex>

The <flex> CSS data type denotes a flexible length within a grid container. It is used in grid-template-columns, grid-template-rows and other related properties.
flex_value#fr css reference