Posted in php errors
726
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

<p>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.</p>
<p>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.&nbsp;</p>
<h4>PHP</h4>
<pre><code class="php hljs">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-&gt;getmetadata() #1 /var/www/html/clash-royale.mmmos.com/lib/SimpleImage.php(47): bones\SimpleImage-&gt;load() #2 /var/www/html/clash-royale.mmmos.com/class/content.class.php(1144): bones\SimpleImage-&gt;_construct() #3 /var/www/html/clash-royale.mmmos.com/pages/view.page.php(530): content-&gt;alsolike() #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): requireonce('/var/www/html/c...') #6 {main} thrown in /var/www/html/clash-royale.mmmos.com/lib/SimpleImage.php on line 1211</code></pre>
<p>I guess first ill check if the image does exist.&nbsp;</p>
<p>Nope the image does not, but its weird that passing an invalid file crashes the whole page.&nbsp;</p>
<h4>HTML</h4>
<pre><code class="html hljs xml">https://clash-royale.mmmos.com/?p=/view/1067/android-game-stuck-on-loading-at-50-for-many-players/</code></pre>
<p>it seems this is causing the error</p>
<p>content.class line 144</p>
<h4>PHP</h4>
<pre><code class="php hljs">$img = new bones\SimpleImage($local
file);</code></pre>
<p>so should just add a check for the $localfile existing before running it through simple image and that should fix it.&nbsp;</p>
<h4>PHP</h4>
<pre><code class="php hljs"> if(file
exists($localfile)) {
include
once("lib/SimpleImage.php");
$img = new bones\SimpleImage($local_file);
$img-&gt;thumbnail(165, 165)-&gt;save($thumbnail, 70);
} else {
$thumbnail = "";
}</code></pre>
<p>check if the file exists and if it does not set the thumbnail to blank or a placeholder probably.&nbsp;</p>

View Statistics
This Week
680
This Month
3590
This Year
774

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...

You could also follow me on twitter. I have a couple of youtube channels if you want to see some video related content. RuneScape 3, Minecraft and also a coding channel here Web Dev.

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
The problem with hoarding is you end up living off your reserves. Eventually, you’ll become stale. If you give away everything you have, you are left with nothing. This forces you to look, to be aware, to replenish. . . . Somehow the more you give away, the more comes back to you.
Paul Arden
Latest News
## 🚀 AI Giants Hit Bullseye: Anthropic & OpenAI Achieve Product-Market Fit Anthropic and OpenAI have reached a significant milestone, finding product-market fit with their AI technologies, which means their products effectively meet the needs of their customers, driving growth and adoption. This achievement showcases the practical value of their innovations, enabling businesses and individuals to leverage AI for enhanced productivity and efficiency. With this alignment of product and market needs, these companies are poised to transform industries and shape the future of technology.