Need Urgent Help Please

My site http://roflsearch.com has been up and running flawlessly for months. I haven’t touched the code for well over a month, and out of the blue I’m getting a php error. My webhost swears nothing has changed on their end, but I expected them to say that regardless…

Error Message:

Warning: getimagesize(http://roflsearch.com/rofl/4846.jpg) [function.getimagesize]: could not make seekable - http://roflsearch.com/rofl/4846.jpg in /home/zomgli5/public_html/roflsearch.com/index.php on line 142

The site displays random images, and the urls that are pulled pertaining to each image is saved on a database. The problem I’m having is that the bar above the image should be the width of the image, but for whatever reason the code i’m using just stopped working out of the blue.

[php]

<?php list($width, $height) = getimagesize($rows['url']);

if($width < 280)
echo “Click”;
else
echo “Click or Browse For Another Random Image”;

?>

[/php]

It’s pretty straight forward, this code simply checks the width of the image and sets an equal width to the bar. If the width is less than 280px a shorter amount of text is visible. Like I said, there hasn’t been an issue since i first wrote this and out of the blue today i’m getting errors. All help is greatly appreciated. Many people use my site regularly so I would like to get it functioning properly for them ASAP. Thanks in advance.

Note: $rows is simply the variable I assigned to the query pulling the image url from the database

First, is the .jpg actually where it is supposed to be. That would be the first thing to check.

Next, sometimes a file is created by a program that saves it as a .jpg when it is really a .jpeg …

This is a very minor issue, but, if your code is looking for a .jpg, it will look at certain places inside the binary data for the width and height. I suggest loading the picture into PaintShop or whatever and RESAVING it as a .jpg. I know this sounds silly, but, I have seen where this fixes this error message. If it doesn’t let us know. You code looks okay as far as I can see…

Al the files are in the correct formats, i have it check all that out on upload. That code worked fine for months until today, I just have no idea what happened or how to fix it.

When you checked the files for correct formats, did you actually read the headers inside of the files or just look at the file extension. That is what I was talking about. EVERY file in the world has some sort of header inside of it. That header tells details of the files. You can take, for instance, a text file and rename it to a .jpg… This will of course, make all programs that try to open it as a jpg fail… The internal header would the that of a text file. This test.jpg would open just fine in NotePad.exe, but, not in Photopaint…

So, how did you “check” the file formats?

I believe the php file just checks the extensions, but regardless i’m the only person uploading images and i"ve only uploaded jpg’s and gif’s. I haven’t uploaded any new images for the last 2 weeks, and I haven’t altered any code for the last couple months.

Everything has run perfectly well for the last couple months until today. This problem occurs with every image, and there’s close to 10,000 in the database.

Oh, you didnt say it was bad with every picture, you just listed one, so, I thought it was just one picture that was bad… Also, you did not show us any code to fix…

Please show us the PHP code that fills these two DIV’s… (The bad code should be in that!)



Warning: getimagesize(
http://roflsearch.com/rofl/4209.jpg) [function.getimagesize]: could not make seekable - http://roflsearch.com/rofl/4209.jpg in /home/zomgli5/public_html/roflsearch.com/index.php on line 142

Click

lol random funny picture

The code was posted in the first post of the thread. The code given there is from line 141 - 148. For what ever reason the code that is given there is no longer working to get the width of the image.

So “getimagesize” is obviously causing the problem, but I don’t understand why because it’s worked fine for months.
[php]
list($width, $height) = getimagesize($rows[‘url’]);[/php]

Any ideas?

RESOLVED: I took the url out of the equation, and pulled the image info directly from the folder like I should have down form the start. Thanks to all that replied.

Did your host happen to upgrade to a newer version of php? that would account for the sudden errors. they also might have changed the error reporting, so those errors might have been there and you just didn’t know it.

They denied any changes to php, and everything sized correctly for months until today. So I still don’t know what caused the problem overnight.

Sponsor our Newsletter | Privacy Policy | Terms of Service