/**
 * lg_deprecated_image_request()
 * Used to create images on the fly
 * 
 * As of Lazyest Gallery version 1.1.0 this file should no longer be called directly
 * only for backward compatibility for hard coded links
 * 
 * @deprecated use ajax call lg_image_request 
 * @return void
 */
function lg_deprecated_image_request()
{
    require_once dirname(__FILE__) . '/inc/frontend.php';
    global $lg_gallery;
    $lg_gallery = new LazyestFrontend();
    if (!isset($lg_gallery)) {
        die('-1');
    }
    $memok = $lg_gallery->valid();
    $thumb = isset($_GET['thumb']);
    $path = pathinfo($lg_gallery->file);
    $folder = new LazyestFrontendFolder($path['dirname']);
    $image = $thumb ? new LazyestThumb($folder) : new LazyestSlide($folder);
    $image->image = $path['basename'];
    if ($thumb) {
        $height = $lg_gallery->get_option('thumbheight');
        $width = $lg_gallery->get_option('thumbwidth');
    } else {
        $height = $lg_gallery->get_option('pictheight');
        $width = $lg_gallery->get_option('pictwidth');
    }
    $cache = $thumb && 'TRUE' == $lg_gallery->get_option('enable_cache') || !$thumb && 'TRUE' == $lg_gallery->get_option('enable_slides_cache');
    if ($memok) {
        if ($cache) {
            $memok = $image->cache();
        } else {
            $memok = $image->resize($width, $height);
        }
    }
    if (!$memok) {
        $alert = imagecreatefrompng($lg_gallery->plugin_dir . '/images/file_alert.png');
        header('Content-type: image/png');
        imagepng($alert);
        imagedestroy($alert);
    } else {
        if (is_resource($image->resized)) {
            switch (strtolower($path['extension'])) {
                case 'jpeg':
                case 'jpg':
                    header('Content-type: image/jpeg');
                    imagejpeg($image->resized);
                    break;
                case 'gif':
                    header('Content-type: image/gif');
                    imagegif($image->resized);
                    break;
                case 'png':
                    header('Content-type: image/png');
                    imagepng($image->resized);
                    break;
                default:
                    break;
            }
            imagedestroy($image->resized);
        }
    }
}
Exemple #2
0
 /**
  * LazyestSearchFrontend::__construct()
  * 
  * @return
  */
 function __construct()
 {
     LazyestFrontend::__construct();
     $this->file = $this->identifier;
     $this->query = $_GET['s'];
     add_filter('the_posts', array(&$this, 'the_posts'));
     add_filter('post_link', array(&$this, 'post_link'), 5, 2);
 }
Exemple #3
0
/**
 * lg_next_thumbs()
 * Shows next page of image thumbnails
 * 
 * @since 1.1.0
 * @return void
 */
function lg_next_thumbs()
{
    global $lg_gallery, $post;
    if ('TRUE' != $lg_gallery->get_option('external_request')) {
        check_ajax_referer('show_thumbs', 'ajax_nonce');
    }
    $lg_plugin_dir = $lg_gallery->plugin_dir;
    define('LG_FRONTEND', true);
    $_SERVER['REQUEST_URI'] = $_POST['request_uri'];
    require_once $lg_plugin_dir . '/inc/frontend.php';
    $lg_gallery = new LazyestFrontend();
    if ('' != $_POST['virtual']) {
        $lg_gallery->set_root(urldecode($_POST['virtual']));
    }
    $start = 1;
    $lg_pagei = isset($_POST['lg_pagei']) ? $_POST['lg_pagei'] : 1;
    if (isset($_POST['folder'])) {
        $path = urldecode($_POST['folder']);
        $folder = new LazyestFrontendFolder($path);
        $folder->load('thumbs');
        $post = get_post(intval($_POST['post_id']));
        $folder->show_thumbs((int) $_POST['perpage'], (int) $_POST['columns'], true);
    } else {
        echo -1;
    }
    die;
}