Example #1
0
     if (isset($_GET['fromcache'])) {
         $fromcache = sanitize($isset($_GET['fromcache']));
     } else {
         $fromcache = getOption('downloadList_zipFromCache');
     }
     AlbumZip::create($item, $fromcache);
     exitZP();
 } else {
     require_once SERVERPATH . '/' . ZENFOLDER . '/lib-MimeTypes.php';
     $item = (int) $item;
     $path = query_single_row("SELECT `aux` FROM " . prefix('plugin_storage') . " WHERE id=" . $item);
     $_downloadFile = internalToFilesystem($path['aux']);
     if (file_exists($_downloadFile)) {
         DownloadList::updateListItemCount($_downloadFile);
         $ext = getSuffix($_downloadFile);
         $mimetype = getMimeString($ext);
         header('Content-Description: File Transfer');
         header('Content-Type: ' . $mimetype);
         header('Content-Disposition: attachment; filename=' . basename(urldecode($_downloadFile)));
         header('Content-Transfer-Encoding: binary');
         header('Expires: 0');
         header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
         header('Pragma: public');
         header('Content-Length: ' . filesize($_downloadFile));
         flush();
         readfile($_downloadFile);
         exitZP();
     } else {
         zp_register_filter('theme_body_open', 'DownloadList::noFile');
     }
 }
Example #2
0
            // Position Overlay in Bottom Right
            $dest_x = max(0, floor(($imw - $nw) * $offset_w));
            $dest_y = max(0, floor(($imh - $nh) * $offset_h));
            zp_copyCanvas($newim, $watermark, $dest_x, $dest_y, 0, 0, $nw, $nh);
            zp_imageKill($watermark);
        }
        $iMutex->unlock();
        if (!zp_imageOutput($newim, $suffix, $cache_path, $quality) && DEBUG_IMAGE) {
            debugLog('full-image failed to create:' . $image);
        }
    }
}
if (!is_null($cache_path)) {
    if ($disposal == 'Download' || !OPEN_IMAGE_CACHE) {
        require_once dirname(__FILE__) . '/lib-MimeTypes.php';
        $mimetype = getMimeString($suffix);
        $fp = fopen($cache_path, 'rb');
        // send the right headers
        header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
        header("Content-Type: {$mimetype}");
        header("Content-Length: " . filesize($image_path));
        // dump the picture and stop the script
        fpassthru($fp);
        fclose($fp);
    } else {
        header('Location: ' . FULLWEBPATH . '/' . CACHEFOLDER . pathurlencode(imgSrcURI($cache_file)), true, 301);
    }
    exitZP();
}
?>
Example #3
0
 /**
  * Gets the feed item data in a gallery feed
  *
  * @param object $item Object of an image or album
  * @return array
  */
 protected function getItemGallery($item)
 {
     if ($this->mode == "albums") {
         $albumobj = newAlbum($item['folder']);
         $totalimages = $albumobj->getNumImages();
         $itemlink = $this->host . $albumobj->getLink();
         $thumb = $albumobj->getAlbumThumbImage();
         $thumburl = '<img border="0" src="' . PROTOCOL . '://' . $this->host . html_encode(pathurlencode($thumb->getCustomImage($this->imagesize, NULL, NULL, NULL, NULL, NULL, NULL, TRUE))) . '" alt="' . html_encode($albumobj->getTitle($this->locale)) . '" />';
         $title = $albumobj->getTitle($this->locale);
         if (true || $this->sortorder == "latestupdated") {
             $filechangedate = filectime(ALBUM_FOLDER_SERVERPATH . internalToFilesystem($albumobj->name));
             $latestimage = query_single_row("SELECT mtime FROM " . prefix('images') . " WHERE albumid = " . $albumobj->getID() . " AND `show` = 1 ORDER BY id DESC");
             if ($latestimage && $this->sortorder == 'latestupdated') {
                 $count = db_count('images', "WHERE albumid = " . $albumobj->getID() . " AND mtime = " . $latestimage['mtime']);
             } else {
                 $count = $totalimages;
             }
             if ($count != 0) {
                 $imagenumber = sprintf(ngettext('%s (%u image)', '%s (%u images)', $count), $title, $count);
             } else {
                 $imagenumber = $title;
             }
             $feeditem['desc'] = '<a title="' . $title . '" href="' . PROTOCOL . '://' . $itemlink . '">' . $thumburl . '</a>' . '<p>' . html_encode($imagenumber) . '</p>' . $albumobj->getDesc($this->locale) . '<br />' . sprintf(gettext("Last update: %s"), zpFormattedDate(DATE_FORMAT, $filechangedate));
         } else {
             if ($totalimages != 0) {
                 $imagenumber = sprintf(ngettext('%s (%u image)', '%s (%u images)', $totalimages), $title, $totalimages);
             }
             $feeditem['desc'] = '<a title="' . html_encode($title) . '" href="' . PROTOCOL . '://' . $itemlink . '">' . $thumburl . '</a>' . $item->getDesc($this->locale) . '<br />' . sprintf(gettext("Date: %s"), zpFormattedDate(DATE_FORMAT, $item->get('mtime')));
         }
         $ext = getSuffix($thumb->localpath);
     } else {
         $ext = getSuffix($item->localpath);
         $albumobj = $item->getAlbum();
         $itemlink = $this->host . $item->getLink();
         $fullimagelink = $this->host . html_encode(pathurlencode($item->getFullImageURL()));
         $thumburl = '<img border="0" src="' . PROTOCOL . '://' . $this->host . html_encode(pathurlencode($item->getCustomImage($this->imagesize, NULL, NULL, NULL, NULL, NULL, NULL, TRUE))) . '" alt="' . $item->getTitle($this->locale) . '" /><br />';
         $title = $item->getTitle($this->locale);
         $albumtitle = $albumobj->getTitle($this->locale);
         $datecontent = '<br />Date: ' . zpFormattedDate(DATE_FORMAT, $item->get('mtime'));
         if ($ext == "flv" || $ext == "mp3" || $ext == "mp4" || $ext == "3gp" || $ext == "mov" and $this->mode != "album") {
             $feeditem['desc'] = '<a title="' . html_encode($title) . ' in ' . html_encode($albumobj->getTitle($this->locale)) . '" href="' . PROTOCOL . '://' . $itemlink . '">' . $thumburl . '</a>' . $item->getDesc($this->locale) . $datecontent;
         } else {
             $feeditem['desc'] = '<a title="' . html_encode($title) . ' in ' . html_encode($albumobj->getTitle($this->locale)) . '" href="' . PROTOCOL . '://' . $itemlink . '"><img src="' . PROTOCOL . '://' . $this->host . html_encode(pathurlencode($item->getCustomImage($this->imagesize, NULL, NULL, NULL, NULL, NULL, NULL, TRUE))) . '" alt="' . html_encode($title) . '" /></a>' . $item->getDesc($this->locale) . $datecontent;
         }
     }
     // title
     if ($this->mode != "albums") {
         $feeditem['title'] = sprintf('%1$s (%2$s)', $item->getTitle($this->locale), $albumobj->getTitle($this->locale));
     } else {
         $feeditem['title'] = $imagenumber;
     }
     //link
     $feeditem['link'] = PROTOCOL . '://' . $itemlink;
     // enclosure
     $feeditem['enclosure'] = '';
     if (getOption("RSS_enclosure") and $this->mode != "albums") {
         $feeditem['enclosure'] = '<enclosure url="' . PROTOCOL . '://' . $fullimagelink . '" type="' . getMimeString($ext) . '" length="' . filesize($item->localpath) . '" />';
     }
     //category
     if ($this->mode != "albums") {
         $feeditem['category'] = html_encode($albumobj->getTitle($this->locale));
     } else {
         $feeditem['category'] = html_encode($albumobj->getTitle($this->locale));
     }
     //media content
     $feeditem['media_content'] = '';
     $feeditem['media_thumbnail'] = '';
     if (getOption("RSS_mediarss") and $this->mode != "albums") {
         $feeditem['media_content'] = '<media:content url="' . PROTOCOL . '://' . $fullimagelink . '" type="image/jpeg" />';
         $feeditem['media_thumbnail'] = '<media:thumbnail url="' . PROTOCOL . '://' . $fullimagelink . '" width="' . $this->imagesize . '"	height="' . $this->imagesize . '" />';
     }
     //date
     if ($this->mode != "albums") {
         $feeditem['pubdate'] = date("r", strtotime($item->getDateTime()));
     } else {
         $feeditem['pubdate'] = date("r", strtotime($albumobj->getDateTime()));
     }
     return $feeditem;
 }