|
Posted by hannes on 03/29/07 11:11
On 27 mrt, 21:27, "Evil Otto" <zburn...@gmail.com> wrote:
> On Mar 27, 11:32 am, "hannes" <hann...@gmail.com> wrote:
>
>
>
>
>
> > On 27 mrt, 11:50, Erwin Moller
>
> > <since_humans_read_this_I_am_spammed_too_m...@spamyourself.com> wrote:
> > > hannes wrote:
> > > > 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,
>
> > > > Hannes
>
> > > Hi Hannes,
>
> > > Check line 134 in your sourcecode of the script that handles the
> > > resizing....
>
> > > How do you expect us to answer such a question based on the information we
> > > receive?
>
> > > Regards,
> > > Erwin Moller
>
> > 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?
>
> 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.- Tekst uit oorspronkelijk bericht niet weergeven -
>
> - Tekst uit oorspronkelijk bericht weergeven -
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)){
}
else{
// nog een keer
if($original = imagecreatefromstring($contents)){
}
else{
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;
}else{
$percent = ($original_height/$original_width);
if($original_width>$original_height){
//horizontaal
//percent < 1
$newwidth = $formaatSmall;
$newheight = $formaatSmall*$percent;
}
else if($original_width<$original_height){
//verticaal
//percent > 1
$newwidth = $formaatSmall/$percent;
$newheight = $formaatSmall;
}
else if($original_width=$original_height){
//vierkant
//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;
if(!is_file($thumbnail)){
$handle2 = fopen($thumbnail,'x');
chmod($thumbnail, 0777);
fclose($handle2);
}
imagejpeg ($thumb, $thumbnail, 60);
fclose($handle);
Navigation:
[Reply to this message]
|