Jump to content

Error in Lazyest Gallery Script


highonlove

Recommended Posts

Hello, can someone help me solve this error?

please look at [a href=\"http://www.evanlevy.ca/\" target=\"_blank\"]http://www.evanlevy.ca/[/a] and click gallery
once you are in the gallery you will see that cold rolled series, undercurrents, and terra nova series all do not work.

normally i do not have the photos for those albums uploaded, just to avoid seeing the ugly error message that it produces.

it only happens when the photos are uploaded into those 3 albums, (any one of the 3, not just all 3 together).

Ive uploaded the photos into the cold rolled series album so that you can see the error.
It happens to al three of them. what is this? and why not the other albums? am i missing something? please help :(

it says error on line 338, but this is all it says on line 338:
!eregi("$temp_category\.(jpeg|jpg|png|gif)", $dir_file)

here is the complete code from the lazyest-gallery.php file:
[code]<?php
/*
Plugin Name: Lazyest Gallery
Plugin URI: http://lazyest.keytwo.net
Description: Easy Gallery management plugin for Wordpress 2.0 with <a href="admin.php?page=lazyest-gallery/lazyest-admin.php" title="Go to the administration page">administration page</a>.
Date: 2006, Jenuary, 31
Author: Keytwo Why
Author URI: http://www.keytwo.net
Version: 0.9.4
*/

/*
    Copyright (C) 2004 Nicholas Bruun Jespersen
        (For questions join discussion on www.lazyboy.dk)
    Copyright (C) 2005 - 2006 Valerio Chiodino
        (For questions join discussion on board.keytwo.net)

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/

// Uncomment this line for development purpose only
// error_reporting(E_ALL);

require_once('lazyest-cache.php');
require_once('lazyest-filemanager.php');
require_once('lazyest-dirs.php');
require_once('lazyest-parser.php');
require_once('lazyest-slides.php');
require_once('lazyest-thumbs.php');
require_once('lazyest-wizard-form.php');

define('LG_VERSION', '0.9.4');
define('LG_ADM_PAGE', 'admin.php?page=lazyest-gallery/lazyest-admin.php');

// Localization domain
load_plugin_textdomain('lazyestgallery','wp-content/plugins/lazyest-gallery/');
$lg_text_domain = "lazyestgallery";

// Initialize all variables
lazyestInit();

// Filter for the gallery page
add_action('wp_head', 'add_lazyest_gallery_style');
add_filter('the_content', 'parse_page_for_gallery');

// Insert the gallery_add_pages() sink into the plugin hook list for 'admin_menu'
add_action('admin_menu', 'gallery_add_pages');

// Filter for the post with images links to the gallery ie:[[Image:folder/img.png|align|110|descr]]
add_filter('the_content', 'parse_posts_for_images');
add_action('wp_head', 'add_post_thumbs_style');

// Adds the gallery browser in the post editor
add_action('edit_form_advanced', 'lg_add_gallery_browser');

// ============== Gallery Main Functions ===============

function showGallery() {                 // Builds main gallery page
    global $file, $gallery_address, $gallery_root, $user_level, $lg_text_domain;

    get_currentuserinfo();

    echo "<div id='gallery'>";

    if (!validateFile()) {
        echo "<div class='error'>";
        echo "<p><b>". __('WARNING', $lg_text_domain) .": </b>". __('Unable to access to the Gallery Folder', $lg_text_domain);
        echo "</p>";
        echo "<p>". __('Check your settings', $lg_text_domain);
        if ($user_level >= 8) {
            echo "<a href='".get_settings('siteurl')."/wp-admin/". LG_ADM_PAGE ."'>";
            _e('here', $lg_text_domain);
            echo "</a>";

        }
        echo "</p></div>";
            return;
    }

    createNavigation();

    $path = pathinfo($file);
    if ($path['extension'] == ''){
        //Display Dir(s) (if any)
        showDirs();
        //Display Thumb(s) (if any)
        showThumbs();
    } else {
        showSlide($file);
    }

    if ($user_level >= 8) {
        echo "<div class='lg_admin'>";
            echo "<a href='".get_settings('siteurl')."/wp-admin/". LG_ADM_PAGE ."'>";
            _e('&raquo; Administrate Gallery', $lg_text_domain);
            echo "</a>";
        echo "</div>";
    }
    echo "<div id='lg_powered'>
                <div class='lgpow'>Powered by <a href='http://lazyest.keytwo.net'>Lazyest Gallery ". LG_VERSION ."</a> - Copyright (C) <a href='http://www.keytwo.net'>Keytwo.net</a></div>
            </div>
        </div>";
}

function parse_page_for_gallery($content){
    global $wpdb, $post, $gallery_root, $gallery_address;

    if(strpos($content, "[[gallery]]") === false) {
        return $content;
    } else {
        showGallery();
    }
}

function add_lazyest_gallery_style(){ ?>
    <link rel="stylesheet" href="<?php bloginfo('home'); ?>/wp-content/plugins/lazyest-gallery/lazyest-style.css" type="text/css" media="screen" />
    <!--[if gte IE 5.5000]>
        <style type="text/css">
            #gallery {
                position:relative;
            }
        </style>
    <![endif]-->
<?php }

// ============= Gallery Utility Functions =============

function lazyestInit() {                    // Define variables values
    global $table_prefix, $gallery_address, $gallery_root, $wpdb;

    $gallery_address = get_option("lg_gallery_folder");

    if(!$gallery_address){
        // assume nothing is set if the gallery folder is not set
        // insert the default values here in the global options-table
        add_option('lg_gallery_folder', 'wp-gallery/', 'Lazyest Gallery: base directory');
        add_option('lg_gallery_uri', get_settings('siteurl'), 'Lazyest Gallery: uri');
        add_option('lg_excluded_folders', array('cgi-bin', 'thumbs', 'slides'), 'Lazyest Gallery: directories to exclude');
        add_option('lg_sort_alphabetically', 'TRUE', 'Lazyest Gallery: Sort files alphabetically');
        add_option('lg_pictwidth', 330, 'Lazyest Gallery: max width of a normal size image');
        add_option('lg_pictheight', 330, 'Lazyest Gallery: max height of a normal size image');
        add_option('lg_thumbwidth', 110, 'Lazyest Gallery: max width of a thumbnail image');
        add_option('lg_thumbheight', 110, 'Lazyest Gallery: max height of a thumbnail image');
        add_option('lg_thumbs_page', 16, 'Lazyest Gallery: #thumbnails to be shown on 1 page');
        add_option('lg_folders_columns', 4, 'Lazyest Gallery: #folders to be shown in 1 row');
        add_option('lg_thumbs_columns', 3, 'Lazyest Gallery: #thumbnails to be shown in 1 row');
        add_option('lg_thumb_folder', 'thumbs/', 'Lazyest Gallery: folder to store cached thumbnails');
        add_option('lg_slide_folder', 'slides/', 'Lazyest Gallery: folder to store cached slides');
        add_option('lg_folder_image', 'none', 'Lazyest Gallery: image to show for each album [none|random_image|icon]');
        add_option('lg_use_slides_popup', 'FALSE', 'Lazyest Gallery: use popup windows for slides');
        // Advanced Stuff
        add_option('lg_enable_cache', 'FALSE', 'Lazyest Gallery: use caching for thumbnails [TRUE|FALSE]');
        add_option('lg_enable_slides_cache', 'FALSE', 'Lazyest Gallery: use caching for slides [TRUE|FALSE]');
        add_option('lg_use_cropping', 'FALSE', 'Use the cropping system for thumbnails');
        add_option('lg_buffer_size', ini_get("memory_limit"), 'Lazyest Gallery: buffer size for image processing');
        // Captions options
        add_option('lg_enable_captions','TRUE','Enable Captions');
        add_option('lg_use_folder_captions', 'FALSE', 'Use folder captions instead of their name');
        // Lightbox support
        add_option('lg_enable_lb_support', 'FALSE', 'Lightbox support');
        add_option('lg_force_lb_support', 'FALSE', 'Force Lightbox support');
        add_option('lg_enable_lb_thumbs_support', 'FALSE', 'Lightbox for thumbs');
        add_option('lg_enable_lb_slides_support', 'FALSE', 'Lightbox for slides');
        add_option('lg_enable_lb_sidebar_support', 'FALSE', 'Lightbox for sidebar');
        add_option('lg_enable_lb_posts_support', 'FALSE','WP-Lightbox for posts');
        // ExIF default settings
        add_option('lg_enable_exif','FALSE','Enable ExIF Data');
        add_option('lg_exif_errors','FALSE','ExIF errors Data');
        add_option('lg_exif_valid_jpeg','FALSE','ExIF valid_jpeg Data');
        add_option('lg_exif_valid_jfif_data','FALSE','ExIF valid_jfif_data Data');
        add_option('lg_exif_jfif_size','TRUE','ExIF jfif_size Data');
        add_option('lg_exif_jfif_identifier','TRUE','ExIF jfif_identifier Data');
        add_option('lg_exif_jfif_extension_code','TRUE','ExIF jfif_extension_code Data');
        add_option('lg_exif_jfif_data','FALSE','ExIF jfif_data Data');
        add_option('lg_exif_valid_exif_data','FALSE','ExIF valid_exif_data Data');
        add_option('lg_exif_app1_size','TRUE','ExIF app1_size Data');
        add_option('lg_exif_endien','TRUE','ExIF endien Data');
        add_option('lg_exif_ifd0_num_tags','FALSE','ExIF ifd0_num_tags Data');
        add_option('lg_exif_ifd0_orientation','TRUE','ExIF ifd0_orientation Data');
        add_option('lg_exif_ifd0_x_res','TRUE','ExIF ifd0_x_res Data');
        add_option('lg_exif_ifd0_y_res','TRUE','ExIF ifd0_y_res Data');
        add_option('lg_exif_ifd0_res_unit','TRUE','ExIF ifd0_res_unit Data');
        add_option('lg_exif_ifd0_software','TRUE','ExIF ifd0_software Data');
        add_option('lg_exif_ifd0_time','TRUE','ExIF ifd0_time Data');
        add_option('lg_exif_ifd0_offset','TRUE','ExIF ifd0_offset Data');
        add_option('lg_exif_ifd1_main_offset','TRUE','ExIF ifd1_main_offset Data');
        add_option('lg_exif_sub_ifd_num_tags','FALSE','ExIF sub_ifd_num_tags Data');
        add_option('lg_exif_sub_ifd_color_space','TRUE','ExIF sub_ifd_color_space Data');
        add_option('lg_exif_sub_ifd_width','TRUE','ExIF sub_ifd_width Data');
        add_option('lg_exif_sub_ifd_height','TRUE','ExIF sub_ifd_height Data');
        add_option('lg_exif_ifd1_num_tags','FALSE','ExIF ifd1_num_tags Data');
        add_option('lg_exif_ifd1_compression','TRUE','ExIF ifd1_compression Data');
        add_option('lg_exif_ifd1_x_res','TRUE','ExIF ifd1_x_res Data');
        add_option('lg_exif_ifd1_y_res','TRUE','ExIF ifd1_y_res Data');
        add_option('lg_exif_ifd1_res_unit','TRUE','ExIF ifd1_res_unit Data');
        add_option('lg_exif_ifd1_jpeg_if_offset','TRUE','ExIF ifd1_jpeg_if_offset Data');
        add_option('lg_exif_ifd1_jpeg_if_byte_count','TRUE','ExIF ifd1_jpeg_if_byte_count Data');
        // Upload settings
        add_option('lg_fileupload_maxk', '300', 'Upload max file size');
        add_option('lg_fileupload_allowedtypes', 'jpg jpeg gif png', 'Allowed upload files');
        add_option('lg_fileupload_minlevel', '6', 'Minimum user level for upload');
        // Microsoft Wizard
        add_option('lg_wizard_user','test','Lazyest Gallery Wizard Username');
        add_option('lg_wizard_password','secret','Lazyest Gallery Wizard Password');

    }

    // Re-define right values for the most important vars
    $gallery_root = str_replace("\\", "/", ABSPATH.get_settings('lg_gallery_folder'));
    $gallery_address = get_settings('siteurl')."/".get_settings('lg_gallery_folder');
}

function setCurrentdir() {
    global $currentdir, $file;
    $path = pathinfo($file);
    if ($path['extension'] != ''){
        $currentdir = $path['dirname'].'/';
        if (substr($currentdir, 0, 1) == "/")
            $currentdir = substr($currentdir, 1, strlen($currentdir));
    }
    else{
        $currentdir = $file;
        if (substr($currentdir, 0, 1) == "/")
            $currentdir = substr($currentdir, 1, strlen($currentdir));

    }
}

function validateFile() {

    global $excluded_folders, $file, $gallery_root;
    $file = $_GET['file'];

    // validate dir
    if ( strstr($file, '..') || strstr($file, '%2e%2e') )
        return false;

    // check wether the file exists and can be read, only proceed if it really exists
    if(!is_readable($gallery_root.$file))
        return false;

    if(is_dir($gallery_root.$file)){
        // check wether it is a directory that is not one of the excluded folders
        $excluded_folders = get_option('lg_excluded_folders');
        foreach ($excluded_folders as $folder){
            if ( strstr($file, $folder) )
                return false;
        }
    }
    else if(!eregi(".*\.(jpg|gif|png|jpeg)", $file)){
        // this must be a regular file => it must be an image file!
        return false;
    }

    setCurrentdir();
    return true;
}

function createNavigation(){
    global $currentdir, $file;

    $gallery_uri = get_option('lg_gallery_uri');
    // Fix for permalinks
    if (strlen(get_option('permalink_structure')) != 0){
        $gallery_uri = $gallery_uri.'?';
    } else {
        $gallery_uri = $gallery_uri.'&amp;';
    }

    if ($currentdir == './')
        $currentdir = '';

    $nav = split('/', $currentdir);
    array_pop($nav);

    $path = pathinfo($file);

    echo '<div style="padding-left:5px;" >Now Viewing: <a href="'. get_settings('siteurl') .'">Home</a> &raquo; <a href="'.get_option('lg_gallery_uri').'">Gallery</a> ';

    foreach ($nav as $n) {
        $current .= $n.'/';
        $current = str_replace(" ", "%20", $current);
        echo '&raquo; <a href="'.$gallery_uri.'file='.$current.'">'.$n.'</a> ';
    }

    if ($path['extension'] != '') {
        $slideUrl = str_replace(" ", "%20", $path['basename']);
        echo '&raquo; <a href="'.$gallery_uri.'file='.$current.$slideUrl.'">'.$path['basename'].'</a>';
    }

    echo '</div>';
}

function get_imgfiles ($dir){
    global $gallery_root, $currentdir;

    if ($dir == '') {
        // use the currentdir in this case
        $location = $gallery_root.substr($currentdir, 0, (strlen($currentdir) -1));
        // Removing eventual trailing slash
        $category = ($currentdir{strlen($currentdir)-1} == '/')? substr($currentdir, 0, (strlen($currentdir) -1)) : $dir;
    } else {
        // use a subdirectory of the currentdir when one is given
        $location = $gallery_root.$currentdir.$dir;
        // Removing eventual trailing slash
        $category = ($dir{strlen($dir)-1} == '/')? substr($dir, 0, (strlen($dir) -1)) : $dir;
    }

    $folders = explode('/', $category);
    $temp_category = $folders[count($folders)-1];

    // Debug code
    /*
    echo "CAT: ".$category."<br />";
    echo "TCAT: ".$temp_category."<br />";
    */

    $imgfiles = array();
    $imgfiles_time = array();
    $img_time_combined = array();
    if (file_exists($location)){
        if ($dir_content = opendir($location)) {
            while ( false !== ($dir_file = readdir($dir_content)) ) {
                if (is_readable($location.'/'.$dir_file) &&
                    eregi('^.*\.(jpg|gif|png|jpeg)$', $dir_file) &&
                    !eregi("$temp_category\.(jpeg|jpg|png|gif)", $dir_file)
                    ){
                        $imgfiles[] = $dir_file;
                }
            }
        }
    }

    if(is_array($imgfiles) && count($imgfiles) > 0) {
        for($d = 0; $d < count($imgfiles); $d++) {
            $imgfiles_time[$d] = filemtime($location.'/'.$imgfiles[$d]);
            $img_time_combined[$imgfiles[$d]] = $imgfiles_time[$d];
        }
        arsort($img_time_combined, SORT_NUMERIC);
        $imgfiles = array_keys($img_time_combined);
    }

    return $imgfiles;
}

/**
* This function is meant to return true if some lightbox plugin is installed
*/

function some_lightbox_plugin(){
    if (
        function_exists(wp_lightbox2) ||
        function_exists(wp_lightbox_plus) ||
        function_exists(wp_lightboxJS) ||
        function_exists(lightbox_styles)
    ){
        return true;
    } else {
        return false;
    }
}

// ================= Admin Options Page ================

function gallery_add_pages() {        // Calls the admin panel file
    global $user_level;

    // gallery_add_pages() is the sink function for the 'admin_menu' hook
    $upload_level = get_settings('lg_fileupload_minlevel');

    if (strlen($upload_level) == 0)
        $upload_level = 10;

    if ($user_level >= $upload_level) {
        add_menu_page('Lazyest Gallery', 'Lazyest Gallery', $upload_level, 'lazyest-gallery/lazyest-admin.php');
        add_submenu_page('lazyest-gallery/lazyest-admin.php', 'Lazyest Gallery', 'File Manager', $upload_level, 'lazyest-gallery/lazyest-filemanager.php', lg_build_captions_form);
    }
    if ($user_level == 10) {
        add_submenu_page('lazyest-gallery/lazyest-admin.php', 'Lazyest Gallery', 'Wizard', 10, 'lazyest-gallery/lazyest-wizard.php', lg_wizard_form);
    }
}

// ================= Captions Functions ================

/**
* This function read from an XML file and return a string with
* the folder caption if the file exists and "false" if it doesn't.
* NOTE: This is an "util" function, so do not call directly,
* call instead clean_folder_caption()
*/

function get_folder_caption($dir) {
    global $gallery_root;

    if (substr($dir, strlen($dir)-1, strlen($dir)) != "/")
        $dir .= '/';

    if (!file_exists($gallery_root.$dir.'captions.xml')) { // This will prevents warnings
        return false;
    }

    // Build essential informations gathering them from the xml file and store into "$arrOutput"
    $data = implode("", file($gallery_root.$dir.'captions.xml'));
    $objXML = new lg_xml2Array();
    $arrOutput = $objXML->parse($data);


    // Debug Code
    // This will print the "$arrOutput" content
    /*
    echo "<pre>";
    print_r($arrOutput);
    echo "</pre>";
    */

    // Gather the caption
    for ($i = 0; $i < count($arrOutput[0][children]); $i++){
        $folder_caption = $arrOutput[0][children][0][tagData];
    }
    return $folder_caption;
}

/**
* This function removes or rebuilds HTML tags (depending the need).
* If $verse is "true" (default) HTML tags are restored
* If $verse is "false" HTML tags are converted from "<" and ">" to "[" and "]"
* It returns false if it fail gather folder caption
* NOTE: This function returns a string
*/

function clean_folder_caption($dir, $verse = true){

    if (!($xml_caption = get_folder_caption($dir))){
        return false;
    }

    if ($verse) {
        $xml_caption = str_replace('"', '\'',  $xml_caption);
        $xml_caption = str_replace('[', '<',  $xml_caption);
        $xml_caption = str_replace(']', '>',  $xml_caption);
    } else {
        $xml_caption = str_replace('"', '\'',  $xml_caption);
        $xml_caption = str_replace('<', '[',  $xml_caption);
        $xml_caption = str_replace('>', ']',  $xml_caption);
    }

    return $xml_caption;
}

/**
* This function read from an XML file and return an associative array
* if the file exists and "false" if it doesn't.
* NOTE: This is an "util" function, so do not call directly,
* call instead clean_image_caption()
* NOTE: This function returns an array
*/

function get_image_caption($imagedir) {
    global $gallery_root;

    if (!file_exists($gallery_root.$imagedir.'captions.xml')) { // This will prevents warnings
        return false;
    }

    // Build essential informations gathering them from the xml file and store into "$arrOutput"
    $data = implode("", file($gallery_root.$imagedir.'captions.xml'));
    $objXML = new lg_xml2Array();
    $arrOutput = $objXML->parse($data);


    // Debug Code
    // This will print the "$arrOutput" content
    /*
    echo "<pre>";
    print_r($arrOutput);
    echo "</pre>";
    */

    // Build the array and return it
    $images = array();
    for ($i = 0; $i < count($arrOutput[0][children]); $i++){
        $images[$i][image] = $arrOutput[0][children][$i][attrs][ID];
        $images[$i][caption] = $arrOutput[0][children][$i][children][0][tagData];
    }

    return $images;
}

/**
* This function removes or rebuilds HTML tags (depending the need).
* If $verse is "true" (default) HTML tags are restored
* If $verse is "false" HTML tags are converted from "<" and ">" to "[" and "]"
* It returns false if it fail gather image captions
* NOTE: This function returns a string
*/

function clean_image_caption($img, $dir, $verse = true){

    if (!($images = get_image_caption($dir))){
        return false;
    }

    for ($i = 0; $i < count($images); $i++) {
        if ($images[$i][image] == $img){
            $xml_caption = $images[$i][caption];
        }
    }

    if ($verse) {
        $xml_caption = str_replace('"', '\'',  $xml_caption);
        $xml_caption = str_replace('[', '<',  $xml_caption);
        $xml_caption = str_replace(']', '>',  $xml_caption);
    } else {
        $xml_caption = str_replace('"', '\'',  $xml_caption);
        $xml_caption = str_replace('<', '[',  $xml_caption);
        $xml_caption = str_replace('>', ']',  $xml_caption);
    }

    return $xml_caption;
}

// ================= Access level functions ============

function get_minimum_folder_level($dir){

    global $gallery_root;

    if (substr($dir, strlen($dir)-1, strlen($dir)) != "/")
        $dir .= '/';

    if (!file_exists($gallery_root.$dir.'captions.xml')) { // This will prevents warnings
        return false;
    }

    // Build essential informations gathering them from the xml file and store into "$arrOutput"
    $data = implode("", file($gallery_root.$dir.'captions.xml'));
    $objXML = new lg_xml2Array();
    $arrOutput = $objXML->parse($data);

    // Gather the caption
    for ($i = 0; $i < count($arrOutput[0][children]); $i++){
        $folder_level = $arrOutput[0][children][1][tagData];
    }
    if ($folder_level == "")
        $folder_level = 1;
    return $folder_level;
}

function lg_user_can_access($folder){
    global $user_level;

    // This is for gallery_root
    if ($folder == "") {
        return true;
    }

    $upper_level = explode('/', $folder);

    for ($i = 0; $i < (count($upper_level)-2); $i++){
        $top .= $upper_level[$i].'/';
    }

    $folder_level = get_minimum_folder_level($folder);
    if (($user_level >= $folder_level || $folder_level == 1)  && lg_user_can_access($top)) {
        return true;
    } else {
        return false;
    }
}

// ===================== Post Functions ================

/**
* This function is used to filter the post content
* and replace particulars tags with the right sobstitution code
* NOTE:
* [[Image:image/name.ext|align|width|height|Caption or description]]
*        |      0       |  1  |  2  |  3   |          4           |
* words[]:
* [0] image file (path) Obligatory
* [1] alignment
* [2] width
* [3] height
* [4] caption
*/

function parse_posts_for_images($content){
    global $wpdb, $post, $gallery_root, $gallery_address;

    $gallery_uri = get_option('lg_gallery_uri');
    // Fix for permalinks
    if (strlen(get_option('permalink_structure')) != 0){
        $gallery_uri = $gallery_uri.'?';
    } else {
        $gallery_uri = $gallery_uri.'&amp;';
    }
    $imagedata = array();
    $posstags = spliti("\\[\\[Image:", $content);
    $new_content = $content;

    // Debug Code
    /*
    echo "<pre>";
    print_r($posstags);
    echo "<pre>";
    */

    // Search for tags
    for ($i = 0; $i <= count($posstags); $i++){
        $smartlink = array();
        eregi('([^\[]*)\\]\\]', $posstags[$i], $smartlink);
        if (strlen($smartlink[1]) > 0)
            $imagedata[] = $smartlink[1];
    }

    // Debug code
    /*
    echo "<pre>";
    print_r($imagedata);
    echo "</pre>";
    */

    // Process tags
    foreach ($imagedata as $imgdata){
      $folder = "";
        if (isset($imgdata)) {
            if($post->post_status == 'static' || strpos($content, $imgdata) === false) {
                return $content;
            }

            $words = explode("|", $imgdata);

            // Trimming spaces
            for($i = 0; $i < count($words); $i++) {
                $words[$i] = trim($words[$i]);
            }

            // Debug Code
            /*
            echo "<pre>";
            print_r($words);
            echo "</pre>";
            */

            // extracts the image from the array
            $words = array_reverse($words);
            $image  = array_pop($words);

            $width = '';
            $height = '';
            $align = array("center","left","right");
            $done = false;
            $alt = '';

            // assigning the right values
            foreach($words as $key){
                if (is_numeric($key) && $widht == ''){
                    $width = $key;
                } else if (is_numeric($key) && $height == ''){
                    $height = $key;
                } else if (!$done && in_array($key, $align)){
                    $align = $key;
                    $done = true;
                } else {
                    $alt = $key;
                }
            }

            if ($width == '') {
                $height = get_option('lg_thumbheight');
                $width = get_option('lg_thumbwidth');
            } else if($height == '') {
                $height = $width;
            }

            // Fixing CSS issues
            if ($align == "center"){
                $center_style = "margin:auto !important;";
            }
            $thumb_width = "width:".($width + 2)."px;";
            // End of CSS issue

            /* =============
            * The Right URL
            * ============= */

            $img = basename($image);
            $folder = str_replace($img, "", $image);
            $title = $alt;
            if (strlen($title) == 0){
                $caption = clean_image_caption($img, $folder);
                $title = ereg_replace("<[^>]*>", "", $caption);
            }
            $xhtml_url = str_replace(" ", "%20", $image);

            // Lightbox URL
            $lb_enabled = get_option('lg_enable_lb_support');
            $lb_posts = get_option('lg_enable_lb_posts_support');
            $lg_scache = get_option('lg_enable_slides_cache');
            $lb_force = get_option('lg_force_lb_support');

            if ($lb_enabled == "TRUE" && $lb_posts == "TRUE" && $lg_scache == "TRUE" && some_lightbox_plugin() || $lb_force == "TRUE") {
                // Cache System code (used for lightbox)
                $slide_folder = get_option('lg_slide_folder');

                if (file_exists($gallery_root.$folder.$img)){
                    if(!file_exists($gallery_root.$folder.$slide_folder.$img) && strlen($image) > 0){
                        createCache($folder, $img, false);
                    }
                }
                $urlImg = str_replace(" ", "%20", $gallery_address.$folder.$slide_folder.$img);

                // Preparing the sobstitution HTML code
                $url="<div class='thumb t$align'>
                        <div style='$thumb_width$center_style' >
                            <a href='$urlImg' rel='lightbox' title='$title' class='internal'>
                                <img src='".get_option('siteurl')."/wp-content/plugins/lazyest-gallery/lazyest-thumbnailer.php?file=$xhtml_url&amp;height=$height&amp;width=$width' alt='$alt'/>
                            </a>
                            <div class='thumbcaption'>
                                <div class='gallerylink' style='float:right'><a href='$gallery_uri"."file=$xhtml_url' class='internal' >
                                    <img src='".get_option('siteurl')."/wp-content/plugins/lazyest-gallery/images/magnify-clip.png' alt='' />
                                </a></div>
                                $title
                            </div>
                        </div>
                    </div>";
            }
            // End of lightbox URL

            // No Lightbox URL
            else {
                // Preparing the sobstitution HTML code
                $url="<div class='thumb t$align'>
                        <div style='$thumb_width$center_style' >
                            <a href='$gallery_uri"."file=$xhtml_url' class='internal'>
                                <img src='".get_option('siteurl')."/wp-content/plugins/lazyest-gallery/lazyest-thumbnailer.php?file=$xhtml_url&amp;height=$height&amp;width=$width' alt='$alt'/>
                            </a>
                            <div class='thumbcaption&#
Link to comment
Share on other sites

[code]Copyright (C) 2004 Nicholas Bruun Jespersen
        (For questions join discussion on www.lazyboy.dk)
    Copyright (C) 2005 - 2006 Valerio Chiodino
        (For questions join discussion on board.keytwo.net)[/code]
That looks like a couple of good places to get information.
Link to comment
Share on other sites

I would have edited my last post, but the edit button isnt working for some reason :( i have back luck, right?
anyways,, i did check those 2 links for information.

the keytwo forum, is working now, but when i tried to register it said my e-mail was banned. which makes no sense since ive never been there before, so i tried using my friend's e-mail to see if it would work, and it said theirs was banned too.... so i guesss it's the boards problem, but i can't register and post.. so i need to get help here.. or at least somewhere else.. :( any ideas?
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.