image upload

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I have a problem with uploading images and creating thumbs from it.

Not all the time, but sometimes, the full size image is completely
uploaded and correct, while the thumbnail only builds a vertical part
of the real image... the rest is grey..

How is that possible? Uploading is not the problem, but resizing
somehow is i guess.

Please help me,


Re: image upload

hannes wrote:

Quoted text here. Click to load it

Hi Hannes,

Check line 134 in your sourcecode of the script that handles the  

How do you expect us to answer such a question based on the information we  

Erwin Moller

Re: image upload

On 27 mrt, 11:50, Erwin Moller
Quoted text here. Click to load it

Haha.. sorry..
well, i thought maybe someone recognises this problem. Why can this
image be grey at the bottom? Maybe you've seen this before and you can
tell me what i should be thinking about?

Re: image upload

Quoted text here. Click to load it

IMHO you should be thinking about providing more information :)

The code would be a good place to start, as well as your PHP version,
what web server you have, what file formats you're allowing, how much
memory you have in your server AND have allocated to PHP..

Basically ANY information would be helpful.

Re: image upload

Quoted text here. Click to load it

this is my code where something goes wrong:
                $handle = fopen($tmpHolder, "rb"); // opent 'temp/tmp.img'
                echo $handle;
                $contents = fread($handle, filesize($tmpHolder));

                if($original         =    imagecreatefromstring($contents)){
                    // nog een keer
                    if($original         =    imagecreatefromstring($contents)){
                        exit("mislukt, probeer het opnieuw<BR>");
                $source             =     imagecreatefromstring($contents);
                $original_width        =    imagesx($original);
                $original_height    =    imagesy($original);

                if($original_width < $formaatSmall){
                            $newwidth             =      $original_width;
                            $newheight             =     $original_height;

                        $percent             =     ($original_height/$original_width);
                            //percent < 1
                            $newwidth             =      $formaatSmall;
                            $newheight             =     $formaatSmall*$percent;
                        else if($original_width<$original_height){
                            //percent > 1
                            $newwidth             =      $formaatSmall/$percent;
                            $newheight             =     $formaatSmall;
                        else if($original_width=$original_height){
                            //percent = 1
                            $newwidth             =      $formaatSmall;
                            $newheight             =     $formaatSmall;

                $thumb                 =     imagecreatetruecolor($newwidth, $newheight);

                if (!imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth,
$newheight, $original_width, $original_height)){
                    exit("aanmaken van thumbnail mislukt<BR>");

                $thumbnail             = $folder_small."/".$form_bestandsnaam;

                    $handle2        =    fopen($thumbnail,'x');
                    chmod($thumbnail, 0777);
                imagejpeg ($thumb, $thumbnail, 60);


Site Timeline