function elimina_immagine()
 {
     $image_name = Params::get("image_name");
     $id_prodotto_servizio = Params::get("id_prodotto_servizio");
     $product_image_dir = new Dir(self::PRODUCT_IMAGE_DIR . "/" . $id_prodotto_servizio);
     $product_image_file = $product_image_dir->newFile($image_name);
     ImagePicker::delete_image_thumbnails($product_image_file);
     //elimino la riga associata all'immagine
     $peer = new ImmagineProdottoServizioPeer();
     $peer->id_prodotto_servizio__EQUALS($id_prodotto_servizio);
     $peer->nome_immagine__EQUALS($image_name);
     $elenco_immagini_prodotto_servizio = $peer->find();
     foreach ($elenco_immagini_prodotto_servizio as $img) {
         $peer->delete($img);
     }
     $product_image_file->delete();
     if ($product_image_dir->isEmpty()) {
         $product_image_dir->delete();
     }
     return Redirect::success();
 }
 function delete_from_gallery()
 {
     $id_gallery_image = Params::get("id_gallery_image");
     $peer = new GalleryImagePeer();
     $gallery_image = $peer->find_by_id($id_gallery_image);
     $gallery_peer = new GalleryPeer();
     $gallery = $gallery_peer->find_by_id($gallery_image->id_gallery);
     $collection_peer = new GalleryCollectionPeer();
     $gallery_collection = $collection_peer->find_by_id($gallery->id_gallery_collection);
     $full_image_path = GalleryCollectionController::GALLERY_COLLECTION_ROOT_DIR . $gallery_collection->folder . "/" . $gallery->folder . "/" . $gallery_image->image_name;
     $f = new File($full_image_path);
     ImagePicker::delete_image_thumbnails($f);
     $f->delete();
     $peer->delete($gallery_image);
     return Redirect::success();
 }
 function delete_image()
 {
     $image_name = Params::get("image_name");
     $f = new File($this->get_current_folder() . "/" . $image_name);
     ImagePicker::delete_image_thumbnails($f);
     $f->delete();
     return Redirect::success();
 }