Please help : Warning: getimagesize(): Read error! Please help : Warning: getimagesize(): Read error!
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Please help : Warning: getimagesize(): Read error!

Started by drakaina, April 21, 2004, 02:54:22 PM

Previous topic - Next topic

0 Members and 3 Guests are viewing this topic.

drakaina

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

hyperion

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.
"Then, Fletch," that bright creature said to him, and the voice was very kind, "let's begin with level flight . . . ."

-Richard Bach, Jonathan Livingston Seagull

(https://coppermine-gallery.com/forum/proxy.php?request=http%3A%2F%2Fwww.mozilla.org%2Fproducts%2Ffirefox%2Fbuttons%2Fgetfirefox_small.png&hash=9f6d645801cbc882a52f0ee76cfeda02625fc537)

Joachim Müller

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

drakaina

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

Joachim Müller

create a small script on your page to test 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

drakaina

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

Joachim Müller

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

drakaina

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
I did check the image path, no problem there . >:(
What could I do next?
Many thanks in advance
Drakaina

Joachim Müller

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

drakaina

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

Joachim Müller

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

Joachim Müller

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 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

Joachim Müller

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

drakaina

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 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?

Joachim Müller

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

drakaina

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

Joachim Müller

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]

drakaina

i get an error telling me I am not allowed to  download nor upload a picture/file on this board :(

Casper

It has been a long time now since I did my little bit here, and have done no coding or any other such stuff since. I'm back to being a noob here

drakaina

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 :(