[PHP] Re: getimagesize() for image resources
Greg Donald wrote: Does anyone know a way to get the size of an an image while it exists as an image resource? getimagesize() appears to work on image files, but not image resources. I need something that works on image resources like those created with the PHP imagecreatefrom* functions. I realize I can write the file to disk, then acquire the info.. that's the step I'm trying to avoid if possible. TIA.. imagesx() and imagesy() -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: getimagesize() for image resources
On Mon, 13 Dec 2004 23:17:22 +0100, M. Sokolewicz [EMAIL PROTECTED] wrote: imagesx() and imagesy() I knew there had to be a way. Thanks so much. -- Greg Donald Zend Certified Engineer http://gdconsultants.com/ http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: getimagesize() MySQL Image Storage (Running functions on contents of variables)
Galen wrote: I'm using a MySQL database to store images as BLOBs. I know how to handle all the MySQL stuff, it's easy, and really makes keeping track of files nice an clean. No permissions, no risk of getting things out of sync, finding stuff is as easy as SQL. My question is about handling stuff once you pull it out of the database. When I store images in the database, I currently stash the format and the resolution in the database, which works but is a bit messy. I can't find any easy way to run getimagesize on the contents of a variable, not a file. I could write the image to a file if I needed to, but that can be slow and rather inelegant, I'd rather store the values in the DB. Any ideas on how I could use getimagesize or similar function to determine the format and resolution of the image in a variable? I have had a similar problem with ftp uploading. There was no way to upload the contents of a variable, so I had to write everything to the disk, kind of annoying when I have 1,000 files. The script wasn't a very heavily used script nor could the public execute it, but it bugged me to no end. I think there are some other functions that also only operate on files and I've fought with them too. Is there any kind of generic solution for this? Some kind of wrapper I could use to make a variable act like a reference to a file but actually be in memory only? If this seems totally pointless, please tell me. But it seems like there should be a way for almost any function that runs off a file to run off the contents of a variable, it's just binary data. Thanks, Galen If the programs read from a file descriptor, you could open a pipe, write into it on your side, and have the command read from it. But that's really messy... and won't work for the image size function. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: getimagesize() MySQL Image Storage (Running functions on contents of variables)
So you're saying there's no way to do what I want to do. Anybody got any other ideas? It seems so stupid to be unable to run functions that accept files on variables, with so many people using databases and whatnot these days. -Galen On Dec 7, 2003, at 1:46 AM, Justin Patrin wrote: Galen wrote: I'm using a MySQL database to store images as BLOBs. I know how to handle all the MySQL stuff, it's easy, and really makes keeping track of files nice an clean. No permissions, no risk of getting things out of sync, finding stuff is as easy as SQL. My question is about handling stuff once you pull it out of the database. When I store images in the database, I currently stash the format and the resolution in the database, which works but is a bit messy. I can't find any easy way to run getimagesize on the contents of a variable, not a file. I could write the image to a file if I needed to, but that can be slow and rather inelegant, I'd rather store the values in the DB. Any ideas on how I could use getimagesize or similar function to determine the format and resolution of the image in a variable? I have had a similar problem with ftp uploading. There was no way to upload the contents of a variable, so I had to write everything to the disk, kind of annoying when I have 1,000 files. The script wasn't a very heavily used script nor could the public execute it, but it bugged me to no end. I think there are some other functions that also only operate on files and I've fought with them too. Is there any kind of generic solution for this? Some kind of wrapper I could use to make a variable act like a reference to a file but actually be in memory only? If this seems totally pointless, please tell me. But it seems like there should be a way for almost any function that runs off a file to run off the contents of a variable, it's just binary data. Thanks, Galen If the programs read from a file descriptor, you could open a pipe, write into it on your side, and have the command read from it. But that's really messy... and won't work for the image size function. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: getimagesize() issues starting with PHP 4.3..
Oops.. Big typo.. It should read that I get *nothing* echo'd back, except newlines :). Thanks again, -JD- --On Tuesday, February 25, 2003 23:27 -0500 Jason DiCioccio [EMAIL PROTECTED] wrote: Can anyone reproduce this problem? I am involved in running a large forum, and ever since our upgrade to PHP 4.3.1, there have been fairly random issues with getimagesize(). It happens only on certain images it seems. However, it wasn't happening with 4.2. When using the following code: ? $retval=getimagesize('http://armanii.c.crosslink.net/arcticsilver/dtmsig4 .j pg'); echo $retval[0] $retval[1] $retval[3] \n\n\n; ? I get echo'd back. It does go an fetch the image according to a tcpdump, but something fails after that. That is an example of one of the images that is failing. I am running PHP 4.3.1 w/ Apache 1.3.27 on FreeBSD 4.7. Is there something I'm missing? Is this a bug as I think it is? Thanks in advance! -JD- -- Jason DiCioccio - [EMAIL PROTECTED] - Useless .sig Open Domain Service - [EMAIL PROTECTED]- http://www.ods.org/ Ruby- [EMAIL PROTECTED] - http://www.ruby-lang.org/ PGP Fingerprint - C442 04E2 26B0 3809 8357 96AB D350 9596 0436 7C08 -- Jason DiCioccio - [EMAIL PROTECTED] - Useless .sig Open Domain Service - [EMAIL PROTECTED]- http://www.ods.org/ Ruby- [EMAIL PROTECTED] - http://www.ruby-lang.org/ PGP Fingerprint - C442 04E2 26B0 3809 8357 96AB D350 9596 0436 7C08 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: getimagesize() with ftp-url?
getimagesize isn't remote. -- Nicos - CHAILLAN Nicolas [EMAIL PROTECTED] www.WorldAKT.com - Hébergement de sites Internet Stefan Wessman [EMAIL PROTECTED] a écrit dans le message de news: [EMAIL PROTECTED] Hi! Can anyone tell me if the getimagesize() function is supposed to work with ftp-url's? The PHP Manual states URL support was added in PHP 4.0.5, but maby that is supposed to mean http-url's only? The following is an expample of how i would like to be able to use getimagesize(): ?php $size = getimagesize(ftp://user:[EMAIL PROTECTED]/pictures/image.jpg;); echo 'pre'; print_r($size); echo '/pre'; ? This code yields the following errors in my log: [12-Oct-2002 23:32:14] PHP Warning: getimagesize(): php_hostconnect: connect failed in getimagesize.php on line 2 [12-Oct-2002 23:32:14] PHP Warning: getimagesize(...): failed to create stream: FTP server reports 227 Entering Passive Mode (194.236.xxx.xxx in getimagesize.php on line 2 Is this a bug, or is it a missing feature, or maby a documentation issue? I've tried it on a few different ftp-servers, so i don't think that is the problem.. but who knows? Any thoghts would be appreciated. /OnionMan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: getimagesize() with ftp-url?
Well, it is remote in the case of http-url's. Try this code: ?php $size = getimagesize(http://www.php.net/gifs/php_logo.gif;); echo 'pre'; print_r($size); echo '/pre'; ? And you will see this result: Array ( [0] = 120 [1] = 64 [2] = 1 [3] = width=120 height=64 [bits] = 8 [channels] = 3 [mime] = image/gif ) My point is that it would be nice if the same could be done with an ftp-url. I don't know if there are any issues that would make this hard to implement, but if it is possible i think this should be added to complement the http-url support. /OnionMan [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... getimagesize isn't remote. -- Nicos - CHAILLAN Nicolas [EMAIL PROTECTED] www.WorldAKT.com - Hébergement de sites Internet Stefan Wessman [EMAIL PROTECTED] a écrit dans le message de news: [EMAIL PROTECTED] Hi! Can anyone tell me if the getimagesize() function is supposed to work with ftp-url's? The PHP Manual states URL support was added in PHP 4.0.5, but maby that is supposed to mean http-url's only? The following is an expample of how i would like to be able to use getimagesize(): ?php $size = getimagesize(ftp://user:[EMAIL PROTECTED]/pictures/image.jpg;); echo 'pre'; print_r($size); echo '/pre'; ? This code yields the following errors in my log: [12-Oct-2002 23:32:14] PHP Warning: getimagesize(): php_hostconnect: connect failed in getimagesize.php on line 2 [12-Oct-2002 23:32:14] PHP Warning: getimagesize(...): failed to create stream: FTP server reports 227 Entering Passive Mode (194.236.xxx.xxx in getimagesize.php on line 2 Is this a bug, or is it a missing feature, or maby a documentation issue? I've tried it on a few different ftp-servers, so i don't think that is t he problem.. but who knows? Any thoghts would be appreciated. /OnionMan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: getimagesize or loop pblm
Arnaud Gonzales wrote: for($i=0;$i=56;$i++){ should be for($i=0;$i56;$i++){ to loop 56 times. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: getimagesize with image in database
Chaillan Nicolas wrote: Hi, There is no way to get the filesize of a file using a remote file. That's not true. GetImageSize works also on remote files. here's my code $imagesize = getimagesize(http://domain/image.jpg); echo $imagesize[3]; but it returns nothing. If I use a local file, without http it works. But I have no clue what's the problem here. Are you sure the file exists? Grtz Erwin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: getimagesize with image in database
Hi, There is no way to get the filesize of a file using a remote file. You should download it to a tmp directory then check. If it is get with an http server, you should code something with sockets to ask to the http server the filesize using a request. -- Merci de nous avoir choisi. - Thanks you for your choice. Nicos - CHAILLAN Nicolas [EMAIL PROTECTED] [EMAIL PROTECTED] www.GroupAKT.com - Hébergement Group. www.WorldAKT.com - Hébergement de sites Internet Chuck Barnett [EMAIL PROTECTED] a écrit dans le message de news: 006901c251d8$3ce1ec20$[EMAIL PROTECTED] Hi, I'm trying to get an image size from an image in a database. here's my code $imagesize = getimagesize(http://domain/image.jpg); echo $imagesize[3]; but it returns nothing. If I use a local file, without http it works. I have php 4.0.6 any suggestions. Thanks, Chuck -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: GetImageSize
Here is the function, but there is nothing wrong with the function I don't think. Here is the function: function GetURLImageSize($urlpic) { return GetImageSize($urlpic); } Here is how we call it: GetURLImageSize (http://www.domainname.com/admin/showimg.php?s=17type=categoryimage=70;); We did write the function like that for a reason... before PHP 4.0.x we used GetURLImageSize because GetImageSize didn't exist yet. blah blah blah... you know what I mean. ~matt Adam [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... For some reason, at random and without warning, the function just seems to stop working and does nothing but wait and timeout at 80 seconds. When you go to the page say www.somedomain.com it just waits and does not load anything for 80 seconds, and when it does, the images that use GetImageSize do not load. Example of the code perhaps? I've never had a problem with that function. -Adam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Re: GetImageSize
For some reason, at random and without warning, the function just seems to stop working and does nothing but wait and timeout at 80 seconds. When you go to the page say www.somedomain.com it just waits and does not load anything for 80 seconds, and when it does, the images that use GetImageSize do not load. Example of the code perhaps? I've never had a problem with that function. -Adam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]