Beispiel #1
0
 function ag_clearOldThumbs($thumbsFolder, $imagesFolder)
 {
     // Generate array of thumbs
     $targetFolder = $thumbsFolder;
     $thumbs = agHelper::ag_imageArrayFromFolder($targetFolder, 0);
     // Generate array of images
     $targetFolder = $imagesFolder;
     $images = agHelper::ag_imageArrayFromFolder($targetFolder, 0);
     if (empty($images)) {
         agHelper::ag_sureRemoveDir($thumbsFolder, 1);
         return;
     }
     // Locate and delete old thumbs
     if (!empty($thumbs)) {
         foreach ($thumbs as $thumbsKey => $thumbsValue) {
             if (!in_array($thumbsValue, $images) && !empty($thumbsValue) && file_exists($thumbsFolder . $thumbsValue)) {
                 unlink($thumbsFolder . $thumbsValue);
             }
         }
     }
 }
Beispiel #2
0
 function loadImageFiles()
 {
     $this->images = agHelper::ag_imageArrayFromFolder($this->imagesFolderPath, $this->params['sortImages']);
 }
Beispiel #3
0
 /**
  *  Loads images array, sorted as defined bu parametar.
  */
 private function loadImageFiles()
 {
     $this->images = agHelper::ag_imageArrayFromFolder($this->imagesFolderPhysicalPath);
     if (!empty($this->images)) {
         $this->images = agHelper::array_sorting($this->images, $this->imagesFolderPhysicalPath, $this->params['arrange']);
     }
     // Paginations Support
     if ($this->params['paginUse']) {
         $this->paginImgTotal = count($this->images);
         $paginImages = array();
         $ag_pagin_start = ($this->paginInitPages[$this->index] - 1) * $this->params['paginImagesPerGallery'];
         $ag_pagin_end = $this->paginInitPages[$this->index] * $this->params['paginImagesPerGallery'] - 1;
         if (!empty($this->images)) {
             for ($i = $ag_pagin_start; $i <= $ag_pagin_end; $i++) {
                 if ($i < $this->paginImgTotal) {
                     $paginImages[] = $this->images[$i];
                 }
             }
         }
         $this->images = $paginImages;
     }
 }
Beispiel #4
0
 // Get Thumb URL value
 // Set Possible Description File Apsolute Path // Instant patch for upper and lower case...
 $ag_pathWithStripExt = $AG->imagesFolderPhysicalPath . $folderName;
 $ag_XML_path = $ag_pathWithStripExt . ".XML";
 if (file_exists($ag_pathWithStripExt . ".xml")) {
     $ag_XML_path = $ag_pathWithStripExt . ".xml";
 }
 if (file_exists($ag_XML_path)) {
     // Check is descriptions file exists
     $ag_XML_xml = simplexml_load_file($ag_XML_path);
     if (isset($ag_XML_xml->thumb)) {
         $thumb_file = (string) $ag_XML_xml->thumb;
     }
 }
 if (empty($thumb_file)) {
     $images = agHelper::ag_imageArrayFromFolder($AG->imagesFolderPhysicalPath . $folderName);
     if (!empty($images)) {
         $images = agHelper::array_sorting($images, $AG->imagesFolderPhysicalPath . $folderName . DIRECTORY_SEPARATOR, $AG->params['arrange']);
         $thumb_file = $images[0];
         // Get First image in folder as thumb
     }
 }
 if (!empty($thumb_file)) {
     $AG->Album_generateThumb($folderName, $thumb_file);
 }
 $html .= '<span class="ag_thumbclassic_centered"> <a href="#" onClick="AG_form_submit_' . $AG->articleID . '(' . $AG->index . ',1,\'' . $AG->imagesFolderName . '/' . $folderName . '\'); return false;" class="AG_album_thumb">';
 $html .= '<span class="AG_album_thumb_img">';
 if (!empty($thumb_file)) {
     $html .= '<img src="' . $AG->sitePath . PLUGIN_BASE_PATH . 'thumbs/' . $AG->imagesFolderName . '/' . $folderName . '/' . basename($thumb_file) . '" />' . "\n";
 } else {
     $html .= '<img src="' . $AG->sitePath . PLUGIN_BASE_PATH . 'defaultAlbum.png" />' . "\n";