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

Home Posts Topics Members FAQ

getimagesize() not working

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.

What's weird is that file(), stat(), lstat(), fopen() and so on all return
FALSE when given the URL (and/or path, where appropriate) of this image.

Even weirder: file_get_conten ts works fine on it.

Using getimagesize() on this file does NOT return any errors. Its like the
info is just empty.

I've been staring at this thing for hours and I'm just drawing a complete
blank.

Got any ideas?

--
Karl Groves
www.karlcore.com
Sep 15 '06 #1
1 5203
*** Karl Groves escribió/wrote (Thu, 14 Sep 2006 19:25:15 -0500):
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.

What's weird is that file(), stat(), lstat(), fopen() and so on all return
FALSE when given the URL (and/or path, where appropriate) of this image.

Even weirder: file_get_conten ts works fine on it.

Using getimagesize() on this file does NOT return any errors. Its like the
info is just empty.
If I understand correctly, you have a PHP script that fetches data from DB
and prints it with an image MIME type header.

If you just feed file_get_conten ts() with the script name, it'll read your
PHP code and it won't (obviously) find its dimensions since it's not an
image but a text file.

You should make file_get_conten ts() load the file through the web server so
the code gets executed:

file_get_conten ts('http://example.com/load_picture.ph p?foo=bar');

The approach, though, does not seem very optimal. You'll be retrieving the
whole pic from DB just to get its size and then discard it. Also,
load_picture.ph p won't be using the visitor session data or cookies.

I've been staring at this thing for hours and I'm just drawing a complete
blank.
I suppose you just want to generate the <imgtag. Add two columns to table
and store width and height when inserting the blob.
--
-+ http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
++ Mi sitio sobre programación web: http://bits.demogracia.com
+- Mi web de humor con rayos UVA: http://www.demogracia.com
--
Sep 15 '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"; }
1
9252
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
1644
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 issues that might be related to first login, but is anyone aware of situations where getimagesize ...
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
7
21641
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: HTTP request failed! HTTP/1.1 404 Not Found in /var/www/vhosts/myweb.com/httpdocs/folder/myphoto.php...
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
9588
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
10589
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...
1
7625
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
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
5663
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3828
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2999
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.