ab Zeile 271:
Code: Alles auswählen
/**
* Resize images with the true diemensions (800*600)
*/
function resize_images()
{
if ( $this->is_image() ) {
$limite_largeur = "400px";
$limite_hauteur = "300px";
$size = getimagesize($this->destination_file);
$largeur = $size[0];
$hauteur = $size[1];
if($hauteur > $limite_hauteur OR $largeur > $limite_largeur)
{
if($largeur > $limite_largeur)
{
$hauteur = $hauteur / ($largeur / $limite_largeur);
$largeur = $limite_largeur;
}
if($hauteur > $limite_hauteur)
{
$largeur = $largeur / ($hauteur / $limite_hauteur);
$hauteur = $limite_hauteur;
}
$destination = imagecreatetruecolor($largeur, $hauteur);
if ( $this->extension == "jpg" || $this->extension == "jpeg" ) $source = imagecreatefromjpeg($this->destination_file);
elseif ( $this->extension == "png" ) $source = imagecreatefrompng($this->destination_file);
elseif ( $this->extension == "gif" ) $source = imagecreatefromgif($this->destination_file);
imagecopyresampled($destination, $source, 0, 0, 0, 0, $largeur, $hauteur, $size[0], $size[1]);
if ( $this->extension == "jpg" || $this->extension == "jpeg" ) imagejpeg($destination, $this->destination_file);
elseif ( $this->extension == "png" ) imagepng($destination, $this->destination_file);
elseif ( $this->extension == "gif" ) imagegif($destination, $this->destination_file);
}
}
}
Code: Alles auswählen
if ( $this->is_image() )
{
$this->resize_images();
}
Gruß Steppe