472,953 Members | 1,889 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,953 software developers and data experts.

Getimagesize ( ) Error message Please Help!

What is with this error message?????? First part validates, second part
fails...

getimagesize (filename...) failed to open stream: No such file or directory

} elseif ($photo) {

$ext = strtolower(substr($photo, -3));

if ($ext == "peg") { $ext = "jpg"; }

if ($ext != "gif" && $ext != "jpg" && $ext != "jpeg" && $ext != "bmp" )
{

$focus = "photo";
$msg2 = "Please provide a valid gif, jpeg, or bmp photo or do not
attach one.";

} else {

$size = getimagesize($photo);

if ($size > 25000) {

$msg2 = "Photo must be smaller than 25k.";
}}}
Jul 17 '05 #1
1 3622
Philip D Heady wrote:

What is with this error message?????? First part validates, second part
fails...

getimagesize (filename...) failed to open stream: No such file or directory

} elseif ($photo) {

$ext = strtolower(substr($photo, -3));

if ($ext == "peg") { $ext = "jpg"; }

if ($ext != "gif" && $ext != "jpg" && $ext != "jpeg" && $ext != "bmp" )
{

$focus = "photo";
$msg2 = "Please provide a valid gif, jpeg, or bmp photo or do not
attach one.";

} else {

$size = getimagesize($photo);

if ($size > 25000) {

$msg2 = "Photo must be smaller than 25k.";

}}}


What is $photo? It should be a URL or a path to a file (either absolute or
relative). However, if you get it working, you'll run into a problem with the
next line. First, getimagesize() returns an array. Second, none of the
elements in the array relate to filesize. They relate to it's type, height and
width.

http://ca.php.net/manual/en/function.getimagesize.php

You should read about filesize():
http://ca.php.net/manual/en/function.filesize.php
Or if this is a file the user has uploaded, try using:
$_FILES['photo']['size']

http://ca.php.net/features.file-upload

Shawn
--
Shawn Wilson
sh***@glassgiant.com
http://www.glassgiant.com
Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: rcb845 | last post by:
Hi everybody of the PHP community, I am using the php function "getimagesize()" to access the width/height of an image from the Web. This function should return false if image is not available....
0
by: Eclectic | last post by:
I am using the latest version of PHP and GD (reinstalled both today - march 29 2005) and am using GD to create thumbnails on the fly. I am having no issues with GD, however, I am now trying to...
1
by: Lucid77 | last post by:
I keep getting an error on line 43 which Is the line in which $image_size = getimagesize($fullsized); occurs, although I cannot seem to find the problem. Any help is much appreciated. Sam ...
1
by: sree | last post by:
Hi, am new bie to this group. I requesting help from you all. Am geeting warnig with getimagesize() function. I will explain my query by first giving my code. $src = $_GET; $imageInfo =...
1
by: lawrence k | last post by:
I've got an intermittent bug that is very hard to trace. On my site, if I log into a new account and try to upload some images, something goes wrong the first time. Everything works fine after the...
7
by: stephcsh | last post by:
Hi, My application is working fine on server A, which is using PHP 4.4.1. However, after it is copied over to server B, which is using PHP 4.4.6, I got several problems related to pdf and xml. ...
6
by: bluesky9394 | last post by:
I encounter the following error. Warning: getimagesize(WebRoot/common/images/profile/) : failed to open stream: Permission denied in C:\Data\PHPSites\kamwo\indextmp-new.php on line 296 but it's...
7
by: Ja NE | last post by:
(as first - thank you for all your help several years ago, and second - please apologise me for my clumsy enlgish) so, preface: some users on my photo related site sometimes enter (link) giant...
0
by: RobUK | last post by:
We have Apache on the local network managing several websites that are accessed using virtual domains (configured in the local machine's hosts file, eg. 192.168.1.10 points to dev.somedomain.com). ...
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.