getimagesize: what's wrong with this?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

getimagesize: what's wrong with this?

Post by simonmlewis »

Code: Select all

<?php
list($width, $height, $type, $attr) = getimagesize("/images/logo.jpg");

echo "Width: " .$width. "<br />";
?>
This is hosted on a live server, with read access to the logo.
This is hosted on an .inc file.
But it's not showing anything except Width:

Why not?
The image is in the right place.
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: getimagesize: what's wrong with this?

Post by Celauran »

What is the function returning?
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Re: getimagesize: what's wrong with this?

Post by simonmlewis »

Nothing whatever on the live.
But locally, with errors on screen:
[text]Warning: getimagesize(/images/logo.jpg): failed to open stream: No such file or directory in C:\xampp\phpMyAdmin\site\includes\a_123.inc on line 2[/text]
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Re: getimagesize: what's wrong with this?

Post by simonmlewis »

The error log on the live server
[text][Thu Dec 12 15:23:30 2013] [warn] [client 89.168.131.11] mod_fcgid: stderr: PHP Warning: getimagesize(/images/pages/8048794test.jpg): failed to open stream: No such file or directory in /var/www/vhosts/site.co.uk/httpdocs/includes/a_home.inc on line 251, referer: http://www.site.co.uk/home[/text]
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
Post Reply