function previewThumbnails() { $thumbs = $this->previewThumbnailsArray(); $index = $this->image->index(); $ret = ""; foreach ($thumbs as $key => $thumb) { $thumbClass = "sgThumbnailPreview"; if ($key == $index - 1) { $thumbClass .= " sgThumbnailPreviewPrev"; } elseif ($key == $index) { $thumbClass .= " sgThumbnailPreviewCurrent"; } elseif ($key == $index + 1) { $thumbClass .= " sgThumbnailPreviewNext"; } $ret .= $thumb->thumbnailLink($thumbClass, "preview") . "\n"; } return $ret; }
/** * Deletes an image from the current gallery. * * @param string the filename of the image to delete (optional) * @return boolean true on success; false otherwise */ function deleteImage($image = null) { if ($image === null) { $image = $this->image->id; } //if file is remote or doesn't exist then there's no point trying to delete it if (!sgImage::isRemote($image) && file_exists($this->config->pathto_galleries . $this->gallery->id . "/" . $image)) { //check that we're not being fooled into deleting something we shouldn't if (!$this->isSubPath($this->config->pathto_galleries, $this->config->pathto_galleries . $this->gallery->id . "/" . $image)) { return $this->pushError($this->translator->_g("Requested item '%s' appears to be outside the galleries directory.", htmlspecialchars($image))); } else { unlink($this->config->pathto_galleries . $this->gallery->id . "/" . $image); } } //remove the image from the images array foreach ($this->gallery->images as $i => $img) { if ($img->id == $image) { array_splice($this->gallery->images, $i, 1); //image removed from array so save metadata if ($this->io->putGallery($this->gallery)) { //nulling image reference will select parent gallery $this->image = null; return $this->pushMessage($this->translator->_g("Image '%s' deleted", htmlspecialchars($image))); } else { return $this->pushError($this->translator->_g("Unable to save metadata.")); } } } //image not found in array return $this->pushError($this->translator->_g("Image not found '%s'", htmlspecialchars($image))); }