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(); }
function image_h($path, $height) { return ImagePicker::get_image_by_height($path, $height); }
<tr> <td align="center"><a target="_immagine_gallery" href="<?php echo $path; ?> "><img border="0px" alt="Immagine gallery" src="<?php echo ImagePicker::get_image_by_height($path, 50); ?> " title="<?php echo $name; ?> " /></a></td> <td><?php echo $name; ?> </td> <td> <!-- comandi per immagine --> <form action="/actions/gallery/delete_image.php" method="post" onsubmit="return window.confirm('Sei sicuro di voler cancellare questa immagine??');"> <input type="hidden" name="image_name" value="<?php echo $name; ?> " /> <input type="submit" name="Elimina" value="Elimina" /> <?php Form::after("/admin/gallery/modifica_immagini.php"); ?> </form> </td> </tr>