Mailinglisten-Archive |
Gruß aus Koblenz
Stefan Neuser
############################
C4 Design Solutions
http://www.c4design.de
Telefon : 0261 / 960 5350
Telefax : 0261 / 952 2509
Mobil : 0179 / 480 9864
Mo-Fr. von 10.00 - 20.00 Uhr
############################
> -----Original Message-----
> From: php-bounces at phpbar.de [mailto:php-bounces at phpbar.de] On
> Behalf Of Stefan Neuser
> Sent: Monday, March 08, 2004 9:48 AM
> To: 'deutschsprachige PHP-Mailingliste'
> Subject: RE: [php] GD2 unterstuetzt kein GIF
>
>
> Hallo :)
>
> > GD2 kann GIFs lesen, also GIFs lesen und PNG ausgeben. Das
> > ist kostenlos.
>
> Hast du eventuell ein Codebeispiel dafür ?
>
SChon ok, war super einfach .. hätte ich nicht gedacht das man es so
lösen kann :)
function CreateImg($file, $filename="", $max=0 ,$addon="") {
$thumbfile = $this->img_dir.$filename.$addon;
$neueHoehe=intval($this->img_detail['height']*$max/$this->img_detail['wi
dth']);
if( $this->img_detail['type']=='image/jpeg' ||
$this->img_detail['type']=='image/jpg' ||
$this->img_detail['type']=='image/pjpeg') {
$altesBild=ImageCreateFromJPEG($file);
$neuesBild=imagecreatetruecolor($max,$neueHoehe);
imagecopyresampled($neuesBild,$altesBild,0,0,0,0,$max,$neueHoehe,$this->
img_detail['width'],$this->img_detail['height']);
if(ImageJPEG($neuesBild,$thumbfile)) return $thumbfile;
else return false;
}
else {
if($this->img_detail['type'] =='image/png')
$altesBild=ImageCreateFromPNG($file);
elseif($this->img_detail['type'] =='image/gif')
$altesBild=ImageCreateFromGIF($file);
else return false;
$neuesBild=imagecreatetruecolor($max,$neueHoehe);
imagecopyresampled($neuesBild,$altesBild,0,0,0,0,$max,$neueHoehe,$this->
img_detail['width'],$this->img_detail['height']);
if(ImagePNG($neuesBild,$thumbfile)) return $thumbfile;
else return false;
}
}
php::bar PHP Wiki - Listenarchive