473,394 Members | 2,063 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

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_contents 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 5154
*** 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_contents 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_contents() 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_contents() load the file through the web server so
the code gets executed:

file_get_contents('http://example.com/load_picture.php?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.php 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
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 =...
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...
2
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...
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. ...
4
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...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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,...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...

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.