Ver Mensaje Individual
  #5 (permalink)  
Antiguo 18/05/2011, 13:11
Avatar de destor77
destor77
 
Fecha de Ingreso: noviembre-2004
Ubicación: Gálvez, Santa Fe, Argentina
Mensajes: 2.654
Antigüedad: 19 años, 5 meses
Puntos: 43
Respuesta: [APORTE] Subir y redimensionar imagenes

esto fue lo que agregue yo, y otra cosa mas que le meti fue un singleton:
Código PHP:
Ver original
  1. public function noResize() {
  2.         $new_image = imagecreatetruecolor($this->getWidth(), $this->getHeight());
  3.  
  4.         //creo la transprencia para los png y gif
  5.         if(($this->image_type == IMAGETYPE_GIF) OR ($this->image_type == IMAGETYPE_PNG)) {
  6.             imagealphablending($this->image, false);
  7.             imagesavealpha($this->image,true);
  8.             $transparent = imagecolorallocate($new_image, 255, 255, 255);//imagecolorallocatealpha($new_image, 255, 255, 255, 127);
  9.             //imagefilledrectangle($new_image, 0, 0, $width, $height, $transparent);
  10.             imagefill($new_image, 0, 0, $transparent);
  11.         }
  12.  
  13.         imagecopyresampled($new_image, $this->image, 0, 0, 0, 0, $this->getWidth(), $this->getHeight(), $this->getWidth(), $this->getHeight());
  14.         $this->image = $new_image;
  15.     }