473,804 Members | 3,305 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

rare, intermittent bug with getimagesize ?


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 issues
that might be related to first login, but is anyone aware of situations
where getimagesize doesn't return a type?
list ($w, $h, $type, $attr) = getimagesize ($src_path);
if (($side = $w) $h) $side = $h;
$dst = imagecreatetrue color (PHOTO_SIDEX, PHOTO_SIDEY);

if ($type == 1 || $type == 2 || $type == 3 || $type == 6) {
/// lots of code goes here
} else {
$controller->error("In makeCroppedPhot o the type of image was '$type'
for image '$src_path' which is not an allowed type. All that is allowed
is gif(1), jpg(2), png(3) and bmp(6)."); }

Sep 12 '06 #1
1 1643

lawrence k wrote:
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 issues
that might be related to first login, but is anyone aware of situations
where getimagesize doesn't return a type?
list ($w, $h, $type, $attr) = getimagesize ($src_path);
if (($side = $w) $h) $side = $h;
$dst = imagecreatetrue color (PHOTO_SIDEX, PHOTO_SIDEY);

if ($type == 1 || $type == 2 || $type == 3 || $type == 6) {
/// lots of code goes here
} else {
$controller->error("In makeCroppedPhot o the type of image was '$type'
for image '$src_path' which is not an allowed type. All that is allowed
is gif(1), jpg(2), png(3) and bmp(6)."); }

Additional testing makes this seem even more odd. fileperms() returns
33279 which is -rwxrwxrwx

a mime-type command I have correctly returns "image/jpeg"

but getimagesize is returning blank. when i hit it with print_r I get
nothing

And all of the 3 above commands are being handed the same address.

Sep 12 '06 #2

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

Similar topics

1
3698
by: Philip D Heady | last post by:
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"; }
3
1869
by: jfsebastian | last post by:
Hi, I am wondering if getImageSize does fetch images *before* extracting the size infos (like perl modules...) or if the function only fetch the few bytes in the file headers which contains the size information ? I am trying to code a similar function in perl, and i think it is very stupid to have to fetch
1
9251
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
5203
by: Karl Groves | last post by:
I am working on a personal project and having trouble with getimagesize() I have an URL to a file I *know* for a fact exists. The url in question is pulling longblob data from the database. This has never been a problem for me before. Moreover, in the past, this has worked for other similar scripts. getimagesize works on every image file I have thrown at it, except these which are coming from the database.
2
3537
by: bizt | last post by:
Hi, Is it possible to obtain the width/ height of an image when that image is dyanically created using a PHP script and passing GET attributes. For example: <img src="images/showImage.php?image_id=5" /> My images are created from images stored on the server, their paths stored on in database table and retrieved using the GET image_id and
4
2594
by: Acrobatic | last post by:
I'm having troubles uploading an image and getting data from getimagesize(). When I upload a file with the name "20050914_loRes_XLH1.jpg", and do a getimagesize on it, it returns no info (null and empty). However, if I change the filename to something like "camera.jpg" and upload it, getimagesize() works perfectly, and I can print_r the array of data. PHP is uploading the files to my /var/temp directory just fine. Also, I have all...
6
17588
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
5160
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 if needed (matamethic of that part isn't written in folowing code and would not be a problem). ...
0
2223
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 is so that I can eventually have a separate server serving images to all websites (a lot of images...
0
9587
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10588
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10340
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9161
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6857
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5527
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5662
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4302
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
3
2998
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.