Re: [PHP] getimagesize()
At 9:14 AM -0500 4/7/06, Ed Curtis wrote: Can you call getimagesize() multiple times in one script? I'm trying to use it multiple times but it only seems to work in the first loop I call it in. I read something in the docs about it cacheing the results and didn't know if this has something to do with it. I also tried creating an array out of the results I get from it but it will only output the size values when it's building the array, never when I try to loop back through it and output the values. Thanks, Ed Ed: Have you tried flush? http://www.weberdev.com/flush or http://www.weberdev.com/ob_flush I haven't used that before, but that's where I would start. HTH's. tedd -- http://sperling.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] getimagesize()
Ed Curtis wrote: Can you call getimagesize() multiple times in one script? I'm trying to use it multiple times but it only seems to work in the first loop I call it in. I read something in the docs about it cacheing the results and didn't know if this has something to do with it. That 'something' you read was a user comment, not the manual. AFAIK, getimagesize() *does no* cache. I also tried creating an array out of the results I get from it but it will only output the size values when it's building the array, never when I try to loop back through it and output the values. Without seeing any code, I can only guess that you're doing something wrong, and need to fix it. -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] getimagesize not working on images from MYSQL
timothy johnson wrote: $id = $_GET['id']; $query = "SELECT * FROM myPhotos WHERE photoId='$id'"; $result = mysql_query($query); $row = mysql_fetch_assoc($result); $im = imagecreatefromstring($row[photoData]); $size = getimagesize($im); header('Content-Type: image/jpeg'); imagejpeg($im, NULL, 100); I have this nice little php page to return my images from a database, and everything runs fine except then I try to use getimagesize, I then get.. Warning: getimagesize(Resource id #4): failed to open stream: do I have to do something else, this function works fine if I am using it on a fileimage, why not an image from a database??? Because the function expects a filename, not an image. Read the documentation for getimagesize. Regards, Burhan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] getimagesize() to find type?
[snip] (1) How would I do that (use getimagesize() instead to find type)? [/snip] http://php.net/getimagesize [snip] (2) Stupid question: how do I say if ($_FILES['imagefile']['type'] != "image/pjpeg") and add "image/jpeg" to that constraint? [/snip] there are many ways, I will show you an easy one if ($_FILES['imagefile']['type'] != "image/pjpeg" && $_FILES['imagefile']['type'] != "image/jpeg") -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] getimagesize() & MySQL Image Storage (Running functions on contents of variables)
Hi, Sunday, December 7, 2003, 6:38:13 PM, you wrote: G> I'm using a MySQL database to store images as BLOBs. I know how to G> handle all the MySQL stuff, it's easy, and really makes keeping track G> of files nice an clean. No permissions, no risk of getting things out G> of sync, finding stuff is as easy as SQL. G> My question is about handling stuff once you pull it out of the G> database. When I store images in the database, I currently stash the G> format and the resolution in the database, which works but is a bit G> messy. I can't find any easy way to run getimagesize on the contents of G> a variable, not a file. I could write the image to a file if I needed G> to, but that can be slow and rather inelegant, I'd rather store the G> values in the DB. Any ideas on how I could use getimagesize or similar G> function to determine the format and resolution of the image in a G> variable? G> I have had a similar problem with ftp uploading. There was no way to G> upload the contents of a variable, so I had to write everything to the G> disk, kind of annoying when I have 1,000 files. The script wasn't a G> very heavily used script nor could the public execute it, but it bugged G> me to no end. I think there are some other functions that also only G> operate on files and I've fought with them too. G> Is there any kind of generic solution for this? Some kind of wrapper I G> could use to make a variable act like a reference to a file but G> actually be in memory only? G> If this seems totally pointless, please tell me. But it seems like G> there should be a way for almost any function that runs off a file to G> run off the contents of a variable, it's just binary data. G> Thanks, G> Galen Do the get sizes while it is still as a file after upload then save the size info with the file in the db or use unpack to get the size from the raw data, it is usually in the header somewhere. -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] @getimagesize
THANKS FOR all your help, I found out it was a custom error handling program that we had that was putting out that error. "John Coggeshall" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Are you using PHP 4.3.2? Try upgrading :) > > John > > On Tue, 2003-06-03 at 05:23, Diana Castillo wrote: > > I use @getimagesize to resize pictures that I get from a url which comes > > from a database which is always changing. The problem is that sometimes the > > url does not contain the picture is is supposed to , and then I get the > > following error - I can't seem to get rid of this error, does anyone know > > how to capture the error so it doesnt come out in a message like this? > > getimagesize(http://www.hotelresb2b.com/images/hoteles/P1KYHC014833.JPG) > > [function.getimagesize]: failed to create stream: HTTP request failed! > > HTTP/1.1 404 Not Found at ReservationManager.php line 299. > > > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > -- > -~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~- > John Coggeshall > john at coggeshall dot org http://www.coggeshall.org/ > -~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] @getimagesize
Are you using PHP 4.3.2? Try upgrading :) John On Tue, 2003-06-03 at 05:23, Diana Castillo wrote: > I use @getimagesize to resize pictures that I get from a url which comes > from a database which is always changing. The problem is that sometimes the > url does not contain the picture is is supposed to , and then I get the > following error - I can't seem to get rid of this error, does anyone know > how to capture the error so it doesnt come out in a message like this? > getimagesize(http://www.hotelresb2b.com/images/hoteles/P1KYHC014833.JPG) > [function.getimagesize]: failed to create stream: HTTP request failed! > HTTP/1.1 404 Not Found at ReservationManager.php line 299. > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- -~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~- John Coggeshall john at coggeshall dot org http://www.coggeshall.org/ -~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] @getimagesize
try an fopen to check if the file is there first ? -Original Message- From: Diana Castillo [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 03, 2003 7:24 PM To: [EMAIL PROTECTED] Subject: [PHP] @getimagesize I use @getimagesize to resize pictures that I get from a url which comes from a database which is always changing. The problem is that sometimes the url does not contain the picture is is supposed to , and then I get the following error - I can't seem to get rid of this error, does anyone know how to capture the error so it doesnt come out in a message like this? getimagesize(http://www.hotelresb2b.com/images/hoteles/P1KYHC014833.JPG) [function.getimagesize]: failed to create stream: HTTP request failed! HTTP/1.1 404 Not Found at ReservationManager.php line 299. -- 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
RE: [PHP] @getimagesize
Check the error reporting level on your server. I tried @getimagesize("http://www.hotelresb2b.com/planos/Pasdasda.gif";) and I got no error at all. One thing you could try is if fopen("http://file";, "r") success, but I don't know if it gives you this stream creating error as well. Remember to close the file right away, if you use that! :) Niklas -Original Message- From: Diana Castillo [mailto:[EMAIL PROTECTED] Sent: 3. huhtikuuta 2003 13:42 To: [EMAIL PROTECTED] Subject: Re: [PHP] @getimagesize according to the documentation on php.net , This function will not work on remote files; the file to be examined must be accessible via the server's filesystem. so it wont work for http "Niklas lampén" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Check if file exists with file_exists(). > > > Niklas > > > -Original Message- > From: Diana Castillo [mailto:[EMAIL PROTECTED] > Sent: 3. huhtikuuta 2003 11:42 > To: [EMAIL PROTECTED] > Subject: [PHP] @getimagesize > > > even though I use a @getimagesize , I still get the following Warning > when the image is not on the server. I need to somehow not have the > warning come out when there is no image there. > > Warning: > getimagesize(http://www.hotelresb2b.com/planos/PLHAHC019330.GIF) > [function.getimagesize]: failed to create stream: HTTP request failed! > HTTP/1.1 404 Not Found at > c:\inetpub\wwwroot\web\site\ReservationManager.php line 190. > > I am using PHP Version 4.3.1 > Thank you , Diana > > ### > This message has been scanned by F-Secure Anti-Virus for Internet Mail. > For more information, connect to http://www.F-Secure.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ### This message has been scanned by F-Secure Anti-Virus for Internet Mail. For more information, connect to http://www.F-Secure.com/ ### This message has been scanned by F-Secure Anti-Virus for Internet Mail. For more information, connect to http://www.F-Secure.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] @getimagesize
according to the documentation on php.net , This function will not work on remote files; the file to be examined must be accessible via the server's filesystem. so it wont work for http "Niklas lampén" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Check if file exists with file_exists(). > > > Niklas > > > -Original Message- > From: Diana Castillo [mailto:[EMAIL PROTECTED] > Sent: 3. huhtikuuta 2003 11:42 > To: [EMAIL PROTECTED] > Subject: [PHP] @getimagesize > > > even though I use a @getimagesize , I still get the following Warning > when the image is not on the server. I need to somehow not have the > warning come out when there is no image there. > > Warning: > getimagesize(http://www.hotelresb2b.com/planos/PLHAHC019330.GIF) > [function.getimagesize]: failed to create stream: HTTP request failed! > HTTP/1.1 404 Not Found at > c:\inetpub\wwwroot\web\site\ReservationManager.php line 190. > > I am using PHP Version 4.3.1 > Thank you , Diana > > ### > This message has been scanned by F-Secure Anti-Virus for Internet Mail. > For more information, connect to http://www.F-Secure.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] @getimagesize
Check if file exists with file_exists(). Niklas -Original Message- From: Diana Castillo [mailto:[EMAIL PROTECTED] Sent: 3. huhtikuuta 2003 11:42 To: [EMAIL PROTECTED] Subject: [PHP] @getimagesize even though I use a @getimagesize , I still get the following Warning when the image is not on the server. I need to somehow not have the warning come out when there is no image there. Warning: getimagesize(http://www.hotelresb2b.com/planos/PLHAHC019330.GIF) [function.getimagesize]: failed to create stream: HTTP request failed! HTTP/1.1 404 Not Found at c:\inetpub\wwwroot\web\site\ReservationManager.php line 190. I am using PHP Version 4.3.1 Thank you , Diana ### This message has been scanned by F-Secure Anti-Virus for Internet Mail. For more information, connect to http://www.F-Secure.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] getimagesize
php 4.3.1. I got it working, this is what i had to use: $imagewidth = getimagesize($_FILES ["image"]["tmp_name"]); if($imagewidth[0] >= "1042") { $img_width = "1024"; } else { $img_width = "*"; } i guess i had to add the tmp_name :) Thanks for the help. cheers, - Sebastian - Original Message - From: "daniel" <[EMAIL PROTECTED]> | what php version ? try putting $_SERVER['PHP_SELF'] in action aswell | | >= Original Message From "Sebastian" <[EMAIL PROTECTED]> = | >nope, still get Warning: getimagesize(Array) | >i've tried everything and it just doesn't get the form data :| | > | >cheers, | >- Sebastian | > | >- Original Message - | >From: "daniel" <[EMAIL PROTECTED]> | > | > | >| try removing that mime check , and put this to lower case encType | >| try for now | >| , let me know | | -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] getimagesize
nope, still get Warning: getimagesize(Array) i've tried everything and it just doesn't get the form data :| cheers, - Sebastian - Original Message - From: "daniel" <[EMAIL PROTECTED]> | try removing that mime check , and put this to lower case encType | try for now | , let me know -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] getimagesize
no it doesn't work, it returns this: Warning: getimagesize(Array) so its not getting the image from the form hmmm cheers, - Sebastian - Original Message - From: "daniel" <[EMAIL PROTECTED]> | well does this not work ? $imagewidth = getimagesize($_FILES['image']); | | and i already have mimetypes checking in my modded pear uploader class, so it | can send error handling bak | | >= Original Message From "Sebastian" <[EMAIL PROTECTED]> = | >What? the ACCEPT? yes it can be done :) | > | >http://www.w3.org/TR/REC-html32.html#rfc1867 | > | >cheers, | >- Sebastian | > | >- Original Message - | >From: "daniel" <[EMAIL PROTECTED]> | > | > | >| wow wots this | >| | >| | >| | >| this is a first i never knew you could do that ? | >| | >| $imagewidth = getimagesize($_FILES['image']); | >| = Original Message From "Sebastian" <[EMAIL PROTECTED]> = | >| >little problem with getimagesize function. I have a form upload and want | >the | >| >images resized only if greater than 1024, if greater than 1024 then i | >want | >| >it to resized, the problem is i do not know if getimagesize is getting | >the | >| >form data: | >| > | >| > | >| >name="sendform"> | >| > | >| > | >| > | >| > | >| > | >| >// some if's ... | >| > | >| >$imagewidth = getimagesize($form_data); | >| > | >| >if($imagewidth[0] >= "1024") { | >| >$img_width = "1024"; | >| >} else { | >| >$img_width = "*"; | >| >} | >| > | >| >// rest of the script to resize... | >| > | >| >so an i doing it the proper way of getting $form_data? | >| > | >| > | >| >cheers, | >| >- Sebastian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] getimagesize
well does this not work ? $imagewidth = getimagesize($_FILES['image']); and i already have mimetypes checking in my modded pear uploader class, so it can send error handling bak >= Original Message From "Sebastian" <[EMAIL PROTECTED]> = >What? the ACCEPT? yes it can be done :) > >http://www.w3.org/TR/REC-html32.html#rfc1867 > >cheers, >- Sebastian > >- Original Message - >From: "daniel" <[EMAIL PROTECTED]> > > >| wow wots this >| >| >| >| this is a first i never knew you could do that ? >| >| $imagewidth = getimagesize($_FILES['image']); >| = Original Message From "Sebastian" <[EMAIL PROTECTED]> = >| >little problem with getimagesize function. I have a form upload and want >the >| >images resized only if greater than 1024, if greater than 1024 then i >want >| >it to resized, the problem is i do not know if getimagesize is getting >the >| >form data: >| > >| > >| >name="sendform"> >| > >| > >| > >| > >| > >| >// some if's ... >| > >| >$imagewidth = getimagesize($form_data); >| > >| >if($imagewidth[0] >= "1024") { >| >$img_width = "1024"; >| >} else { >| >$img_width = "*"; >| >} >| > >| >// rest of the script to resize... >| > >| >so an i doing it the proper way of getting $form_data? >| > >| > >| >cheers, >| >- Sebastian >| >| >| >| -- >| 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
Re: [PHP] getimagesize
What? the ACCEPT? yes it can be done :) http://www.w3.org/TR/REC-html32.html#rfc1867 cheers, - Sebastian - Original Message - From: "daniel" <[EMAIL PROTECTED]> | wow wots this | | | | this is a first i never knew you could do that ? | | $imagewidth = getimagesize($_FILES['image']); | = Original Message From "Sebastian" <[EMAIL PROTECTED]> = | >little problem with getimagesize function. I have a form upload and want the | >images resized only if greater than 1024, if greater than 1024 then i want | >it to resized, the problem is i do not know if getimagesize is getting the | >form data: | > | > | > | > | > | > | > | > | >// some if's ... | > | >$imagewidth = getimagesize($form_data); | > | >if($imagewidth[0] >= "1024") { | >$img_width = "1024"; | >} else { | >$img_width = "*"; | >} | > | >// rest of the script to resize... | > | >so an i doing it the proper way of getting $form_data? | > | > | >cheers, | >- Sebastian | | | | -- | 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
RE: [PHP] getimagesize
wow wots this this is a first i never knew you could do that ? $imagewidth = getimagesize($_FILES['image']); = Original Message From "Sebastian" <[EMAIL PROTECTED]> = >little problem with getimagesize function. I have a form upload and want the >images resized only if greater than 1024, if greater than 1024 then i want >it to resized, the problem is i do not know if getimagesize is getting the >form data: > > > > > > > > >// some if's ... > >$imagewidth = getimagesize($form_data); > >if($imagewidth[0] >= "1024") { >$img_width = "1024"; >} else { >$img_width = "*"; >} > >// rest of the script to resize... > >so an i doing it the proper way of getting $form_data? > > >cheers, >- Sebastian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] getimagesize
Where you get this error from? Does it come from the browser or is it the script output? Diana Castillo wrote: anyway to not get an error when doing getimagesize if you get this response? HTTP request failed! HTTP/1.1 404 Not Found -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] getimagesize
no that doesnt work, anything else? "Dan Rossi" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > @getimagesize ? > > -Original Message- > From: Diana Castillo [mailto:[EMAIL PROTECTED] > Sent: Thursday, March 27, 2003 5:04 AM > To: [EMAIL PROTECTED] > Subject: [PHP] getimagesize > > > anyway to not get an error when doing getimagesize if you get this response? > HTTP request failed! HTTP/1.1 404 Not Found > > > > -- > 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
RE: [PHP] getimagesize
@getimagesize ? -Original Message- From: Diana Castillo [mailto:[EMAIL PROTECTED] Sent: Thursday, March 27, 2003 5:04 AM To: [EMAIL PROTECTED] Subject: [PHP] getimagesize anyway to not get an error when doing getimagesize if you get this response? HTTP request failed! HTTP/1.1 404 Not Found -- 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
Re: [PHP] getimagesize() issues starting with PHP 4.3..
--On Wednesday, February 26, 2003 16:35 +1000 Tom Rogers <[EMAIL PROTECTED]> wrote: Hi, Wednesday, February 26, 2003, 2:27:10 PM, you wrote: JD> Can anyone reproduce this problem? [...] JD> $retval=getimagesize('http://armanii.c.crosslink.net/arcticsilver/dtmsig4 .j JD> pg'); JD> echo "$retval[0] $retval[1] $retval[3] \n\n\n"; ?>> [...] Try $retval=getimagesize("http://armanii.c.crosslink.net/arcticsilver/dtmsig4 .jpg",$info); ..seems to wake it up :) ..possible bug?? -- regards, Tom Thanks! It would appear so, as it's documented as being an optional argument.. It works for me that way too, though. Cheers, -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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] getimagesize() issues starting with PHP 4.3..
Hi, Wednesday, February 26, 2003, 2:27:10 PM, you wrote: JD> Can anyone reproduce this problem? JD> I am involved in running a large forum, and ever since our upgrade to PHP JD> 4.3.1, there have been fairly random issues with getimagesize(). It JD> happens only on certain images it seems. However, it wasn't happening with JD> 4.2. When using the following code: JD> $retval=getimagesize('http://armanii.c.crosslink.net/arcticsilver/dtmsig4.j JD> pg'); JD> echo "$retval[0] $retval[1] $retval[3] \n\n\n"; ?>> JD> I get echo'd back. It does go an fetch the image according to a tcpdump, JD> but something fails after that. That is an example of one of the images JD> that is failing. JD> I am running PHP 4.3.1 w/ Apache 1.3.27 on FreeBSD 4.7. Is there something JD> I'm missing? Is this a bug as I think it is? JD> Thanks in advance! JD> -JD- JD> -- JD> Jason DiCioccio - [EMAIL PROTECTED] - Useless .sig JD> Open Domain Service - [EMAIL PROTECTED]- http://www.ods.org/ JD> Ruby- [EMAIL PROTECTED] - http://www.ruby-lang.org/ JD> PGP Fingerprint - C442 04E2 26B0 3809 8357 96AB D350 9596 0436 7C08 Try $retval=getimagesize("http://armanii.c.crosslink.net/arcticsilver/dtmsig4.jpg",$info); ..seems to wake it up :) ..possible bug?? -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] getimagesize() with ftp-url?
I remember I got these kinds of "errors" when I wanted to connect to a slow server, the last message was always something like "port command successfull", and that was it. Try connection to localhost, if that works? Stefan Wessman wrote: >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(): > >$size = >getimagesize("ftp://user:[EMAIL PROTECTED]/pictures/image.jpg";); > >echo ''; >print_r($size); >echo ''; >?> > >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
Re: [PHP] getimagesize or loop pblm
You can calculate the image size when adding the image (rather than when displaying it) and store the information in a file or a database. This file or database you could use for posting the right sizes for popup windows. Sascha Am Montag, 7. Oktober 2002 03:22 schrieb arnaud gonzales: > So my code is clean ? There isn't a problem of infiny loop? > My server is free.fr. > How do u suggest i can cach the data? > > -Message d'origine- > De : Rasmus Lerdorf [mailto:[EMAIL PROTECTED]] > Envoye : lundi 7 octobre 2002 03:07 > A : arnaud gonzales > Cc : Php-General > Objet : Re: [PHP] getimagesize or loop pblm > > > It could take a while. Depends how fast your server's disk sub-system is. > Going to disk to stat and open an image and then parse through the initial > headers to get the sizing data can take some time. I'd suggest caching > this data somewhere if you are going to need it on every request. > > -Rasmus > > On Mon, 7 Oct 2002, arnaud gonzales wrote: > > Hi all, > > Does anybody can tell me why i have this error :"Fatal error: Maximum > > execution time of 5 seconds exceeded in photos2.php on line 28" > > whith this > > > > > > $tab_img = array(); > > $tab_img_size = array(); > > for($i=0;$i=56;$i++){ > > $tab_img[$i] = >"images/tof/real_size/techp02_".$i.".jpg"; > > $tab_img_size = array( > > /* line 28 */ $i => getimagesize($tab_img[$i])); > > } > > > > Is the getimagesize function too long for making it 56 times?? > > What do u think ? > > In fact i want to get all the image size to make a popup link on the > > thumnail at the real size of the image.Because images don't have the same > > size and i want to have a clean window whith the popup. > > I've ever tried this before : > > > > $tab_img = array(); > > $tab_img_size = array(); > > for($i=0;$i=56;$i++){ > > $tab_img[$i] = >"images/tof/real_size/techp02_".$i.".jpg"; > > $tab_img_size[$i] = getimagesize($tab_img[$i]); > > } > > Hope you understand. > > TIA. > > zeg > > > > > > > > -- > > 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
RE: [PHP] getimagesize or loop pblm
So my code is clean ? There isn't a problem of infiny loop? My server is free.fr. How do u suggest i can cach the data? -Message d'origine- De : Rasmus Lerdorf [mailto:[EMAIL PROTECTED]] Envoye : lundi 7 octobre 2002 03:07 A : arnaud gonzales Cc : Php-General Objet : Re: [PHP] getimagesize or loop pblm It could take a while. Depends how fast your server's disk sub-system is. Going to disk to stat and open an image and then parse through the initial headers to get the sizing data can take some time. I'd suggest caching this data somewhere if you are going to need it on every request. -Rasmus On Mon, 7 Oct 2002, arnaud gonzales wrote: > Hi all, > Does anybody can tell me why i have this error :"Fatal error: Maximum > execution time of 5 seconds exceeded in photos2.php on line 28" > whith this > > > $tab_img = array(); > $tab_img_size = array(); > for($i=0;$i=56;$i++){ > $tab_img[$i] = >"images/tof/real_size/techp02_".$i.".jpg"; > $tab_img_size = array( > /*line 28 */ $i => getimagesize($tab_img[$i])); > } > > Is the getimagesize function too long for making it 56 times?? > What do u think ? > In fact i want to get all the image size to make a popup link on the > thumnail at the real size of the image.Because images don't have the same > size and i want to have a clean window whith the popup. > I've ever tried this before : > > $tab_img = array(); > $tab_img_size = array(); > for($i=0;$i=56;$i++){ > $tab_img[$i] = >"images/tof/real_size/techp02_".$i.".jpg"; > $tab_img_size[$i] = getimagesize($tab_img[$i]); > } > Hope you understand. > TIA. > zeg > > > > -- > 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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] getimagesize or loop pblm
It could take a while. Depends how fast your server's disk sub-system is. Going to disk to stat and open an image and then parse through the initial headers to get the sizing data can take some time. I'd suggest caching this data somewhere if you are going to need it on every request. -Rasmus On Mon, 7 Oct 2002, arnaud gonzales wrote: > Hi all, > Does anybody can tell me why i have this error :"Fatal error: Maximum > execution time of 5 seconds exceeded in photos2.php on line 28" > whith this > > > $tab_img = array(); > $tab_img_size = array(); > for($i=0;$i=56;$i++){ > $tab_img[$i] = >"images/tof/real_size/techp02_".$i.".jpg"; > $tab_img_size = array( > /*line 28 */ $i => getimagesize($tab_img[$i])); > } > > Is the getimagesize function too long for making it 56 times?? > What do u think ? > In fact i want to get all the image size to make a popup link on the > thumnail at the real size of the image.Because images don't have the same > size and i want to have a clean window whith the popup. > I've ever tried this before : > > $tab_img = array(); > $tab_img_size = array(); > for($i=0;$i=56;$i++){ > $tab_img[$i] = >"images/tof/real_size/techp02_".$i.".jpg"; > $tab_img_size[$i] = getimagesize($tab_img[$i]); > } > Hope you understand. > TIA. > zeg > > > > -- > 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
Re: [PHP] getImageSize
check the permissions on the directory the image is in as well On Wed, 2002-10-02 at 12:51, Dan McCullough wrote: > anyone know what migth cause this error. I changed the mode to 777, made sure that >is was the > correct owner.group. > getimagesize: Unable to open 'images/product/i3_berkeley_bed_2drw.jpg' for reading > > = > > "Theres no such thing as a problem unless the servers are on fire!" > > > __ > Do you Yahoo!? > New DSL Internet Access from SBC & Yahoo! > http://sbc.yahoo.com > > -- > 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
Re: [PHP] getimagesize with image in database clairifation
in my example I'm not pulling from a db. It does not even work like I have it in my example though. Thanks, Chuck - Original Message - From: "Chuck Barnett" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Sunday, September 01, 2002 11:54 AM Subject: [PHP] getimagesize with image in database 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
Re: [PHP] GetImageSize and iptcparse problems
On Thursday 07 February 2002 05:02, Steven Jarvis wrote: > I've read the manual, and I'm still stuck, partially due to the manual > itself. This is the first time I've dealt with this particular issue > (parsing IPTC info from JPEGs). > > The example provided in the manual entry on GetImageSize: > > $size = GetImageSize ("testimg.jpg",&$info); > if (isset ($info["APP13"])) { > $iptc = iptcparse ($info["APP13"]); > var_dump ($iptc); > } > ?> > > Gives me the following error on php 4.0.6: > > Warning: Call-time pass-by-reference has been deprecated - argument > passed by value; If you would like to pass it by reference, modify the > declaration of getimagesize(). If you would like to enable call-time > pass-by-reference, you can set allow_call_time_pass_reference to true in > your INI file. However, future versions may not support this any longer. What this error is saying is that you cannot use &$info ie: GetImageSize ("testimg.jpg",&$info); > I don't understand what I need to pass to getImageSize in order to > extract the IPTC info. You can try: GetImageSize ("testimg.jpg", $info); > Can someone point me in the right direction with this? If the above doesn't work, then you probably have to change your php.ini as per error message. For more info on pass-by-reference see the chapter "References Explained" > "Passing by Reference". -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk /* We gave you an atomic bomb, what do you want, mermaids? -- I. I. Rabi to the Atomic Energy Commission */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] GetImageSize Problem
You can get this information from header of this image file. Structure of BMP is here: http://www.dcs.ed.ac.uk/home/mxr/gfx/2d/BMP.txt (found with google.com) M.N. --- [EMAIL PROTECTED] wrote: Hello, I'm PHPer from Korea. I have a problem with GetImageSize function. I wanted to know some information about BMP image. So, I tried to use GetImageSize on PHP 4.0.5 , Linux. But, it didn't work. GetImageSize function returned nothing. Then, I tried it on PHP 4.0.6, Windows2000. Ooops.. I worked.. -.-; I looked the php.net manual, but there's no mention about my problem. Does anyone know how to solve this problem.. ? Do you know @MESSAGE? Powered by 3R Soft, Inc. -- 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]
Re: [PHP] getimagesize (Bug? or error in PhP?)
On 23 May 2001 04:15:09 -0700, [EMAIL PROTECTED] ("bram") wrote: >I' have version Version 4.0.4pl1 URL support was added in PHP 4.0.5 ! So it won't work with 4.04... Bert -- 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]
Re: [PHP] getimagesize (Bug? or error in PhP?)
I' have version Version 4.0.4pl1 > Hi, > > I want to have the width and the height of an image, if I place the image on > my server then it works buth if i want to load the image from another server > then I have errors, is this a bug in PHP, or is there another solution. > Because in the php.net manual they use Getimagesize() too for loading an > image from another site > (http://www.php.net/manual/en/function.getimagesize.php) > Please post a message if you know what I must do, thanks > bram > > > > GetImageSize > > > $url="http://toontime.dk/cli/pt09.jpg";; > $imagehw = GetImageSize("$url"); > $imagewidth = $imagehw[0]; > $imageheight = $imagehw[1]; > print"$imagewidth "; > print"$imageheight "; > ?> > > > > > > > -- > 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 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]
Re: [PHP] GetImageSize() problem...
> I might have the same problem with PHP 4.0.5 (win2k). Some of the images > from my Kodak DC-260 digital camera, are not recognized correctly by > getimagesize for some reason.. > > Example: > > $imagehw = > GetImageSize("http://maasdelta.eve-software.com/foto/kinderspelen/P0007811.J > PG"); >print $imagehw . ""; >print $imagehw[0] . ""; >print $imagehw[1] . ""; >print $imagehw[3] . ""; > ?> > http://maasdelta.eve-software.com/foto/kinderspelen/P0007811.JPG";> > > This image is just a normal JPG (1536x1024) taken directly from my camera. > > GetImageSize however, thinks it's dimensions are: 51088x38655 ??? This also > happens when I access the file from a local drive. > > Anyone got a clue ? I had a look at this problem in the plane coming back from Europe yesterday. There is definitely a problem in the code. The php_handle_jpeg() function is not hitting the right markers for some reason. My brain was too oxygen-deprived to see the cause, but I will try to get to it. As a workaround for now I suggest you use the read_exif_data() function instead. Compile using --enable-exif. That will definitely get you the right dimensions along with many other properties. -Rasmus -- 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]
Re: [PHP] GetImageSize() problem...
""Eric Knudstrup"" <[EMAIL PROTECTED]> schreef in bericht [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I am having an issue with 4.0.5 where the following code snippet: > > $orig = imagecreatefromjpeg($tmp); > echo 'orig x: ' . imagesx($orig) . ' orig y: ' . imagesy($orig) > . ''; > $orig_size = getimagesize($tmp); > echo "orig x: $orig_size[0] orig y: $orig_size[1] "; > > produces: > > orig x: 1200 orig y: 1600 > orig x: orig y: > > The test image was produced from my Canon S100 and the Canon image > downloading software. I might have the same problem with PHP 4.0.5 (win2k). Some of the images from my Kodak DC-260 digital camera, are not recognized correctly by getimagesize for some reason.. Example: http://maasdelta.eve-software.com/foto/kinderspelen/P0007811.J PG"); print $imagehw . ""; print $imagehw[0] . ""; print $imagehw[1] . ""; print $imagehw[3] . ""; ?> http://maasdelta.eve-software.com/foto/kinderspelen/P0007811.JPG";> This image is just a normal JPG (1536x1024) taken directly from my camera. GetImageSize however, thinks it's dimensions are: 51088x38655 ??? This also happens when I access the file from a local drive. Anyone got a clue ? Edwin. -- 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]
Re: [PHP] GetImageSize
It appears like so. "Joseph Bannon" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > What version of PHP are you using? According to the manual: > > "URL support was added in PHP 4.0.5" > > > > Oh, I have 4.0.4. I need to upgrade don't I?!? > > Thanks, > J > > -- > 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 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]
RE: [PHP] GetImageSize
> What version of PHP are you using? According to the manual: > "URL support was added in PHP 4.0.5" Oh, I have 4.0.4. I need to upgrade don't I?!? Thanks, J -- 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]
Re: [PHP] GetImageSize
What version of PHP are you using? According to the manual: "URL support was added in PHP 4.0.5" Moody "Joseph Bannon" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > For some reason, I can get the image image size for an image on the local > machine, but remotely give me an error > > > My code > > $size = GetImageSize ("images/title.gif"); > echo "size: $size[0]"; > echo "size: $size[1]"; > echo "size: $size[2]"; > echo "size: $size[3]"; > $size = GetImageSize > ("http://www.picpage.com/users/ka/kaurisma1331/images/image0.jpg";); > echo "size: $size[0]"; > echo "size: $size[1]"; > echo "size: $size[2]"; > echo "size: $size[3]"; > ?> > > > > Output > > > size: 310 > size: 80 > size: 1 > size: width="310" height="80" > Warning: Unable to open > http://www.picpage.com/users/ka/kaurisma1331/images/image0.jpg in > web/imagetest.php on line 13 > size: > size: > size: > size: > > -- > 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 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]
Re: [PHP] GetImageSize() problem...
I think that was the first thing I tried. It might have something to do with the actual image itself. Images created with th PHP/GD routines come up with acceptable results. Thanks, Eric Quoting Dan Lowe <[EMAIL PROTECTED]>: > Previously, Eric Knudstrup said: > > I am having an issue with 4.0.5 where the following code snippet: > > > > $orig = imagecreatefromjpeg($tmp); > > echo 'orig x: ' . imagesx($orig) . ' orig y: ' . > imagesy($orig) > > . ''; > > $orig_size = getimagesize($tmp); > > echo "orig x: $orig_size[0] orig y: $orig_size[1] > "; > > have you tried this as the last line instead? > > echo 'orig x: ' . $orig_size[0] . ' orig y: ' . $orig_size[1] . > ''; > > -dan > > > produces: > > > > orig x: 1200 orig y: 1600 > > orig x: orig y: > > > > The test image was produced from my Canon S100 and the Canon image > > downloading software. > > > > Can anyone help? > > > > Thanks, > > > > Eric > > > > > > -- > > 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] > > -- > All good technology should be used to piss off people's parents. -Neil > Gaiman > -- 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]
RE: [PHP] getimagesize question
$size = getimagesize($Frame."top.gif"); I think you should read this : http://www.zend.com/zend/tut/using-strings.php Sincerely, Maxim Maletsky Founder, Chief Developer PHPBeginner.com (Where PHP Begins) [EMAIL PROTECTED] www.phpbeginner.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Sunday, February 04, 2001 5:28 AM To: [EMAIL PROTECTED] Subject: [PHP] getimagesize question Hi, I`m using the following to get the image size... $size = getimagesize("$Frame"); My problem is $Frame can`t contain the full name of the image for various reasons, so what I need to do is somehow add the rest, something along the lines of this... $size = getimagesize("$Frame'top.gif'"); If $Frame = Hello then the getimagesize would perform on Hellotop.gif but as yet it isn`t working anyone have a suggestion? I have tried a few variations such as ("$Frame" + "top.gif") ("$Frame\"top.gif\"") ($Frame"top.gif") Thanks Ade -- 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 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]
Re: [PHP] getimagesize question
Tom, Thanks for that, worked a treat. Ade -- 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]
Re: [PHP] getimagesize question
Hi Ade, To combine strings, you simply use a period. For example: $image = $frame . "top.gif"; If $frame is "hello", then $image will come out as "hellotop.gif". Hope that helped... Regards, Tom _ Tomeeboy.com - Your place for the best stuff on the net! Visit http://www.tomeeboy.com today! - Original Message - From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Saturday, February 03, 2001 3:27 PM Subject: [PHP] getimagesize question > Hi, > > I`m using the following to get the image size... > > $size = getimagesize("$Frame"); > > My problem is $Frame can`t contain the full name of the image for various > reasons, so what I need to do is somehow add the rest, something along the > lines of this... > > $size = getimagesize("$Frame'top.gif'"); > > If $Frame = Hello then the getimagesize would perform on Hellotop.gif but as > yet it isn`t working anyone have a suggestion? I have tried a few variations > such as > > ("$Frame" + "top.gif") > ("$Frame\"top.gif\"") > ($Frame"top.gif") > > Thanks > Ade > > -- > 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 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]
RE: [PHP] getimagesize question
To get the imagesize $PictSize = GetImageSize ($file_image_path . $PictName); $pictW = $PictSize[0]; $pictH = $PictSize[1]; -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Saturday, 3 February 2001 9:28 PM To: [EMAIL PROTECTED] Subject: [PHP] getimagesize question Hi, I`m using the following to get the image size... $size = getimagesize("$Frame"); My problem is $Frame can`t contain the full name of the image for various reasons, so what I need to do is somehow add the rest, something along the lines of this... $size = getimagesize("$Frame'top.gif'"); If $Frame = Hello then the getimagesize would perform on Hellotop.gif but as yet it isn`t working anyone have a suggestion? I have tried a few variations such as ("$Frame" + "top.gif") ("$Frame\"top.gif\"") ($Frame"top.gif") Thanks Ade -- 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 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]
Re: [PHP] GetImageSize problem
On Sun, Jan 21, 2001 at 07:02:07PM +0100, Thies C. Arntzen wrote: > On Sun, Jan 21, 2001 at 03:05:31PM +, Sue Bailey wrote: > > I have a bunch of images living on one ISP's server which I want to use > > on another page on another ISP's server, with GetImageSize. I RTFM, and > > see "The filename needs to be either relative to the current document, > > or an absolute filesystem path. Thus absolute URL paths will not work." > > which is absolutely correct - I get an error msg "cannot open file". > > $DOCUMENT_ROOT is obviously no use to me - does anyone know any way > > round this? > > try the latest snapshot of PHP 4 from snaps.php.net. it > supports URLs in the getinagesize() function. Hi Sue, Thies Arntzen made a typo, it is the getimagesize() function. Look at page 497 and use "string imagefile" in newer versions as URL. -Egon -- http://www.linuxtag.de/ http://php.net/books.php http://www.concert-band.de/ mailto:[EMAIL PROTECTED] -- 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]
Re: [PHP] GetImageSize problem
On Sun, Jan 21, 2001 at 03:05:31PM +, Sue Bailey wrote: > I have a bunch of images living on one ISP's server which I want to use > on another page on another ISP's server, with GetImageSize. I RTFM, and > see "The filename needs to be either relative to the current document, > or an absolute filesystem path. Thus absolute URL paths will not work." > which is absolutely correct - I get an error msg "cannot open file". > $DOCUMENT_ROOT is obviously no use to me - does anyone know any way > round this? try the latest snapshot of PHP 4 from snaps.php.net. it supports URLs in the getinagesize() function. tc -- 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]
Re: [PHP] GetImageSize problem
If you relly don't like the text jumping you can do a little script that can parse the width and height for each image, I mean get this info from the html files... But you will have to pin point each one... The good thing that the script is here... http://www.rezox.com) # define(GIF_SIG, "\x47\x49\x46"); define(JPG_SIG, "\xff\xd8\xff"); define(PNG_SIG, "\x89\x50\x4e\x47\x0d\x0a\x1a\x0a"); define(JPG_SOF0, "\xc0"); /* Start Of Frame N */ define(JPG_SOF1, "\xc1"); /* N indicates which compression process */ define(JPG_SOF2, "\xc2"); /* Only SOF0-SOF2 are now in common use */ define(JPG_SOF3, "\xc3"); define(JPG_SOF5, "\xc5"); /* NB: codes C4 and CC are NOT SOF markers */ define(JPG_SOF6, "\xc6"); define(JPG_SOF7, "\xc7"); define(JPG_SOF9, "\xc9"); define(JPG_SOF10, "\xca"); define(JPG_SOF11, "\xcb"); define(JPG_SOF13, "\xcd"); define(JPG_SOF14, "\xce"); define(JPG_SOF15, "\xcf"); define(JPG_EOI, "\xd9"); /* End Of Image (end of datastream) */ define(JPG_SOS, "\xda"); /* Start Of Scan - image data start */ define(RD_BUF, 512); /* amount of data to initially read */ function GetURLImageSize( $urlpic $fd= @fopen($urlpic,"r"); fd){ #read in 1k, enough for GIF,PNG. #continue to read from file, if the JPG chunk exceeds this $imgData = fread( $fd,RD_BUF ); if( substr($imgData,0,3)==GIF_SIG $dim =unpack ("v2dim",substr($imgData,6,4) ); $width=$dim["dim1"]; $height=$dim["dim2"]; $type = 1; } elseif( substr($imgData,0,8)==PNG_SIG $dim =unpack ("N2dim",substr($imgData,16,8) ); $width=$dim["dim1"]; $height=$dim["dim2"]; $type = 3; } elseif( substr($imgData,0,3)==JPG_SIG # JPG CHUNK SCAN $imgPos = 2; $type = 2; $buffer = RD_BUF-2; while($imgPos < strlen($imgData)) /* synchronize to the marker 0xFF */ $imgPos=strpos(&$imgData,0xFF,$imgPos)+1; $marker = $imgData[$imgPos]; do { $marker = ord($imgData[$imgPos++]); } while ($marker == 255); /* find dimensions of block */ switch (chr($marker)) /* Grab width/height from SOF segment (these are acceptable chunk types) */ case JPG_SOF0: case JPG_SOF1: case JPG_SOF2: case JPG_SOF3: case JPG_SOF5: case JPG_SOF6: case JPG_SOF7: case JPG_SOF9: case JPG_SOF10: case JPG_SOF11: case JPG_SOF12: case JPG_SOF13: case JPG_SOF14: case JPG_SOF15: $dim =unpack ("n2dim",substr($imgData,$imgPos+3,4) ); $height=$dim["dim1"]; $width=$dim["dim2"]; break 2; file://found it so exit case JPG_EOI: case JPG_SOS: return FALSE;/* End loop in case we find one of these markers */ default:/* We're not interested in other markers */ $skiplen = (ord($imgData[$imgPos++])<<8)+ord($imgData[$imgPos++])-2; /* if the skip is more than what we've read in, read more */ $buffer -= $skiplen; if( $buffer<512 ){ #if the buffer of data is too low,read more file. $imgData .= fread( $fd,$skiplen+1024 ); $buffer += $skiplen+1024; }; $imgPos += $skiplen; break; }; file://endif check marker type }; file://endif loop through JPG chunks }; file://endif chk for valid file types # got the pic dimensions, close the file fclose ($fd); return array( $width,$height,$type ); } else return array( '','','' ); }; file://endif valid file pointer chk }; // end function ?> Rom - Original Message - From: Sue Bailey <[EMAIL PROTECTED]> To: Romulo Roberto Pereira <[EMAIL PROTECTED]> Cc: php-general <[EMAIL PROTECTED]> Sent: Sunday, January 21, 2001 10:35 AM Subject: Re: [PHP] GetImageSize problem Thanks Rom - I can get the pics with an img src tag, which is why I assumed that GetImageSize would also work - but now I'm told it only works on the local machine, so I guess I'll have to live with text jumping about while pics download. :( Romulo Roberto Pereira wrote: > > Hello! > > First - some ISP block you from get files from their server by a httpd > request (that is what php does... I think!). To be sure if this is set or > not, in the other ISP (not the one that the images are) write a simple html > like this: > &g
Re: [PHP] GetImageSize problem
Thanks Rom - I can get the pics with an img src tag, which is why I assumed that GetImageSize would also work - but now I'm told it only works on the local machine, so I guess I'll have to live with text jumping about while pics download. :( Romulo Roberto Pereira wrote: > > Hello! > > First - some ISP block you from get files from their server by a httpd > request (that is what php does... I think!). To be sure if this is set or > not, in the other ISP (not the one that the images are) write a simple html > like this: > > loading images between servers > > http://Domain/ImagesDir/ImagesName.gif"> > > > In "http://Domain/ImagesDir/ImagesName.gif" be sure to put the correct > domain and location of the image. > > This should show the image... If not you could have two problems: the link > is wrong or the filter is set. > > Imagine this - I have a web site in an ISP with my domain like: > http://www.mydomain.com and all the paths are gting the images from a free > server like geocities.com so I don;t expend money on buying large amounts of > bandwith for my site... If you think this way you know why they do that. > > if this works, just use thi path "http://Domain/ImagesDir/ImagesName.gif" in > all your scripts for getimagesize... > > I expect that this helps. > > Rom > > -- > 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 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]
Re: [PHP] GetImageSize problem
Hello! First - some ISP block you from get files from their server by a httpd request (that is what php does... I think!). To be sure if this is set or not, in the other ISP (not the one that the images are) write a simple html like this: loading images between servers http://Domain/ImagesDir/ImagesName.gif"> In "http://Domain/ImagesDir/ImagesName.gif" be sure to put the correct domain and location of the image. This should show the image... If not you could have two problems: the link is wrong or the filter is set. Imagine this - I have a web site in an ISP with my domain like: http://www.mydomain.com and all the paths are gting the images from a free server like geocities.com so I don;t expend money on buying large amounts of bandwith for my site... If you think this way you know why they do that. if this works, just use thi path "http://Domain/ImagesDir/ImagesName.gif" in all your scripts for getimagesize... I expect that this helps. Rom -- 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]