473,516 Members | 2,865 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3664
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
3947
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. Most of the time the function works correctly, but in 2 or 3 cases I have a problem like, search is going on for minutes, and the function does
0
2238
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 retrieve the width and height of other images withought ANY sucess ... I am recieving the same error repeatedly : "... failed to open stream: No such...
1
4272
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 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html...
1
9178
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 = getimagesize($src);
1
1616
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 first time, but the first time getimagesize fails to return a type, which is blank in the following error messge. I'm going to check for weird path...
7
21609
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. 1) I got this message when i tried to generate a pdf, with image: getimagesize(http://www.myweb.com/image/photo_2.jpg) : failed to open stream:...
6
17446
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 working fine on my another php script. php code: $path = "WebRoot/common/images/profile/"; $file = $row1;
7
5146
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 photo in their post or coment, and while I was writting new bbcode for my forum, I have got idea to check size of linked pictures to scale them down...
0
2179
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). I am reworking the way that I access images on the site by specifying the http://etc address of the image instead of the local relative address. This...
0
7408
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7548
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5714
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
4773
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3267
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3259
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1624
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
825
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
488
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.