coppermine-gallery.com/forum

Support => Older/other versions => cpg1.2 Standalone Support => Topic started by: drakaina on April 21, 2004, 02:54:22 PM

Title: Please help : Warning: getimagesize(): Read error!
Post by: drakaina on April 21, 2004, 02:54:22 PM
Hello,
I've been trying to upload images in my albums but everytime I get this message telling me the images could not be uploaded because it was impossible to resize or create thumbnail (translated from french below) :
"Les images 'albums/userpics/10001/4.jpg' ne peuvent pas être insérées dans l'album

Impossible de créer l'vignette ou l'image réduite.



Warning: getimagesize(): Read error! in /home/drakaina/www/galeries/include/picmgmt.inc.php on line 193     "

Could someone please help me figure it out? I really like CPG 1.2 and would love to have it work properly  :wink:
However it has worked with for 2 images but won't work again  :cry:
Thanks for all the help you could give me
Drakaina
Title: Please help : Warning: getimagesize(): Read error!
Post by: hyperion on April 21, 2004, 11:28:33 PM
getimagesize is a built in PHP function that collects information about image files.  The error is telling you that it does not understand the image file. This could have many reasons:

1. The relevant PHP files could be corrupted or out of date.  

2. The image may be of a type not handled by the function.


You should try:

1. Saving the image in other formats and in other imaging software. Then try uploading again.

2. Updating to the latest stable version of PHP.
Title: Please help : Warning: getimagesize(): Read error!
Post by: Joachim Müller on April 22, 2004, 06:42:20 AM
getimagesize has been reported to consume large resources, that's why some webhosts decided to disable the function. Happened with my webhost as well, and they didn't bother to notify their customers. Took me a while to figure. If you're webhosted and getimagesize used to work for you once, contact your webhost and ask them for support.

GauGau
Title: Re: Please help : Warning: getimagesize(): Read error!
Post by: drakaina on April 22, 2004, 03:08:23 PM
Quote from: hyperion on April 21, 2004, 11:28:33 PM

You should try:

1. Saving the image in other formats and in other imaging software. Then try uploading again.

2. Updating to the latest stable version of PHP.
Hello and thanks for your advices  :)
My pictures are all in a jpeg format and were created in photoshop 7.
About the lates version of PHP, all I have is coppermine , phpmyadmin2.2.6 and and MySQL.. which one should I change (as you can see I am fairly new to all of this lol ::)     )

Yes GauGau I am actually webhosted but I was able to upload an image and then (the same day, about 2 mns later) all I kept getting was this error message... I am really puzzled here  ???
Thank you both for taking the time to help me  :-*
Drakaina
Title: Re: Please help : Warning: getimagesize(): Read error!
Post by: Joachim Müller on April 22, 2004, 03:15:19 PM
create a small script on your page to test getimagesize (http://www.php.net/getimagesize) and run it in your browser, like this<?php
list($width$height$type$attr) = getimagesize("img/flag.jpg");
echo 
"<img src=\"img/flag.jpg\" $attr alt=\"getimagesize() example\" />";
?>
(you'll have to modify the img/flag.jpg-bit accordingly to point to a pic that actually exists on your page.

GauGau
Title: Re: Please help : Warning: getimagesize(): Read error!
Post by: drakaina on April 22, 2004, 03:24:14 PM
Call me "stupid" but on which page I am I supposed to put the script you are telling me about?? I am really sorry to bug you with this but I am so completly lost :(...
Drakaina
Title: Re: Please help : Warning: getimagesize(): Read error!
Post by: Joachim Müller on April 22, 2004, 03:42:14 PM
create a new file on your hard drive, name it test.php, open it with a text editor, paste the code mentioned above into it (edit the image path accordingly), save it, upload it to your webroot and run it in your browser http://yoursite.tld/test.php
If you don't understand one word, you'd better contact your webhost and ask them for support...

GauGau
Title: Re: Please help : Warning: getimagesize(): Read error!
Post by: drakaina on April 22, 2004, 07:09:05 PM
hello again  :D
I did that and all I get is a red cross  :( Here is the link to the test http://drakaina.com/test.php (http://drakaina.com/test.php)
I did check the image path, no problem there . >:(
What could I do next?
Many thanks in advance
Drakaina
Title: Re: Please help : Warning: getimagesize(): Read error!
Post by: Joachim Müller on April 24, 2004, 12:25:24 PM
it's not recommended to post a link to your phpinfo, might be a security risk. I recommend removing the phpinfo file from your webserver.
Apparently you can use coppermine; it should be able to run without getimagesize as well, you'll just have to edit a little code...

GauGau
Title: Re: Please help : Warning: getimagesize(): Read error!
Post by: drakaina on April 24, 2004, 01:59:27 PM
Thank you GauGau I will remove it asap :)
I am glad to know I can use coppermine :)
Quoteit should be able to run without getimagesize as well, you'll just have to edit a little code...
ok but how do I do that? I mean i can edit a file and change the code as long as i know what i am supposed to do lol ;)
Thanks
Drakaina
Title: Re: Please help : Warning: getimagesize(): Read error!
Post by: Joachim Müller on April 24, 2004, 02:08:45 PM
Will require massive code changes. It's best to create a custom function called getimagesize if you don't have the one from php.
Hard to tell you what to do exactly, since getimagesize is being used in 10 files.

GauGau
Title: Re: Please help : Warning: getimagesize(): Read error!
Post by: Joachim Müller on April 24, 2004, 02:45:41 PM
on second thought, I think I didn't read your original posting properly: after all getimagesize is there, but returns an error! This is what the manual (http://www.php.net/function.getimagesize) says about that error:
QuoteIf accessing the filename image is impossible, or if it isn't a valid picture, getimagesize() will return FALSE and generate a warning.

So, there are two things to check: did you chmod correctly? Is the pic a valid image? If you're not sure, post a deep link to the page in question.

GauGau
Title: Re: Please help : Warning: getimagesize(): Read error!
Post by: Joachim Müller on April 24, 2004, 03:02:35 PM
for those who actually don't have getimagesize (that doesn't mean you, drakaina) : you could use something like this in include/functions.inc.php:<?php

if (function_exists(getimagesize)==false)
{
  function 
getimagesize($contents) {
    return 
getimagesize_url($contents);
    }
}

function 
getimagesize_url($image_url) {
   
$handle fopen ($image_url"rb");
   
$contents "";
   if (
$handle) {
   do {
       
$count += 1;
       
$data fread($handle8192);
       if (
strlen($data) == 0) {
           break;
       }
   
$contents .= $data;
   } while(
true);
   } else { return 
false; }
   
fclose ($handle);

   
$im ImageCreateFromString($contents);
   if (!
$im) { return false; }
   
$gis[0] = ImageSX($im);
   
$gis[1] = ImageSY($im);
// array member 3 is used below to keep with current getimagesize standards
   
$gis[3] = "width={$gis[0]} height={$gis[1]}";
   
ImageDestroy($im);
   return 
$gis;
}


?>

GauGau
Title: Re: Please help : Warning: getimagesize(): Read error!
Post by: drakaina on April 24, 2004, 03:33:30 PM
Quote from: GauGau on April 24, 2004, 02:45:41 PM
on second thought, I think I didn't read your original posting properly: after all getimagesize is there, but returns an error! This is what the manual (http://www.php.net/function.getimagesize) says about that error:
QuoteIf accessing the filename image is impossible, or if it isn't a valid picture, getimagesize() will return FALSE and generate a warning.

So, there are two things to check: did you chmod correctly? Is the pic a valid image? If you're not sure, post a deep link to the page in question.

GauGau
Well I chmoded in 777 sinceI thought that was why i could not upload the pics. My images are all in jpeg so I do not see why they would be invalid (could they?) Beside these pics are the same already uploaded on my website so I know they do work.
Thanks
Drakaina
Ps : could it be that I do  not have enought web space (on my webhost) left or something likethat?
Title: Re: Please help : Warning: getimagesize(): Read error!
Post by: Joachim Müller on April 24, 2004, 03:55:27 PM
If 777 doesn't work for you try 755 (depends on server config).
There a differences in jpegs as well - there have been reports that only jpegs in RBG work, CMYK ones won't.

GauGau
Title: Re: Please help : Warning: getimagesize(): Read error!
Post by: drakaina on April 24, 2004, 04:01:27 PM
Ok I changed it back to 755 and I checked for the files, they are RGB jpegs (from photoshop 7)
I am currently looking at the file picmgmt.inc.php  since it says my error comes from line 193 on this page. Is this where I shoul change the code?
Drakaina
Title: Re: Please help : Warning: getimagesize(): Read error!
Post by: Joachim Müller on April 24, 2004, 04:11:00 PM
Please try with another jpeg image, like the one attached to this posting, as the line in picmgmt.php is actually there to verfiy wether a pic is valid or not.

GauGau

[attachment deleted by admin]
Title: Re: Please help : Warning: getimagesize(): Read error!
Post by: drakaina on April 24, 2004, 04:24:44 PM
i get an error telling me I am not allowed to  download nor upload a picture/file on this board :(
Title: Re: Please help : Warning: getimagesize(): Read error!
Post by: Casper on April 24, 2004, 05:43:32 PM
Then just right click, and 'save picture as'
Title: Re: Please help : Warning: getimagesize(): Read error!
Post by: drakaina on April 24, 2004, 05:56:34 PM
I just did but here is what i got :
The picture 'albums/userpics/10001/beispiel.jpg' can't be inserted in the album

Unable to create thumbnail or reduced size image.



Warning: getimagesize(): Read error! in /home/drakaina/www/galeries/include/picmgmt.inc.php on line 193

Drakaina :(
Title: Re: Please help : Warning: getimagesize(): Read error!
Post by: Joachim Müller on April 25, 2004, 07:24:06 AM
well then I guess your CHMOD settings are still wrong. If you can't manage this on your own, I suggest you ask your webhost for support (maybe they have disabled CHMODing for you altogether). Ask them to CHMOD the albums folder and everything within it to be readable and writable by the webserver/script and readable for everyone.

GauGau