Ejemplo n.º 1
0
 protected function save($tmp_name)
 {
     $info = $this->getInfo($tmp_name);
     $img = new Image();
     $img->setSize(filesize($tmp_name));
     $img->setHeight($info[1]);
     $img->setWidth($info[0]);
     $img->setType($img->getTypeFromImagesizeConst($info[2]));
     $this->_em->persist($img);
     $this->_em->flush();
     if (rename($tmp_name, $this->generateFileName($img->getId(), $img->getType()))) {
         $this->last_image = $img;
         return true;
     } else {
         $this->_errors[] = 'Image save error!';
         return false;
     }
 }
Ejemplo n.º 2
0
 public function setSize($size)
 {
     $this->__load();
     return parent::setSize($size);
 }