Not signed in (Sign In)

Vanilla 1.1.10 is a product of Lussumo. More Information: Documentation, Community Support.

    • CommentAuthorDacevedoVE
    • CommentTimeJun 23rd 2010 edited
     
    Hi, i have been using Plogger since for a long time but the old version, now i want to install the new version but i dont know how to call a thumbnail, in the old version a do it like this

    In the first line of the page i put this code


    <?php include('admin/conn.php');

    function generate_thumb($path, $prefix, $type = 'small') {
    global $config;
    require_once("./galeria/lib/phpthumb/phpthumb.class.php"); //PHP thumb class

    if (substr($path,0,1) != '/') {
    $source_file_name = $config['basedir'] . 'images/' . $path;
    } else {
    $source_file_name = $path;
    }

    if (!is_readable($source_file_name)) {
    return false;
    };

    $imgdata = @getimagesize($source_file_name);

    if (!$imgdata) {
    return false;
    }

    $base_filename = sanitize_filename(basename($path));

    global $thumbnail_config;

    $thumb_config = $thumbnail_config[$type];
    $prefix = $thumb_config['filename_prefix'] . $prefix . "-";
    $thumbpath = $config['basedir'] . 'thumbs/'.$prefix.$base_filename;
    $thumburl = $config['baseurl'] . 'thumbs/'.$prefix.$base_filename;
    list($width, $height, $type, $attr) = @getimagesize($thumbpath);

    if (!file_exists($thumbpath) ||
    ($thumb_config['filename_prefix'] == '' && !$config['square_thumbs'] && $thumb_config['size'] != $height) ||
    ($thumb_config['filename_prefix'] == '' && !$config['square_thumbs'] && $width == $height) ||
    ($thumb_config['filename_prefix'] == '' && $config['square_thumbs'] && $width != $height) ||
    ($thumb_config['filename_prefix'] != '' && $thumb_config['size'] != $width) ||
    ($thumb_config['filename_prefix'] == '' && $config['square_thumbs'] && $thumb_config['size'] != $height && $thumb_config['size'] != $width)) {
    $phpThumb = new phpThumb();
    $phpThumb->setSourceFileName($source_file_name);
    $phpThumb->w = $thumb_config['size'];
    $phpThumb->q = $config['compression'];

    if ($thumb_config['filename_prefix'] == '' && $config['square_thumbs']) {
    $phpThumb->zc = 1;
    $phpThumb->h = $thumb_config['size'];
    }

    $phpThumb->config_use_exif_thumbnail_for_speed = false;

    if (!$config['square_thumbs']) {
    $phpThumb->h = $thumb_config['size'];
    $phpThumb->w = '';
    }

    $phpThumb->config_error_die_on_error = false;

    if ($phpThumb->GenerateThumbnail()) {
    $phpThumb->RenderToFile($thumbpath);
    }
    else {
    die('Failed: '.implode("\n", $phpThumb->debugmessages));
    }
    }
    return $thumburl;
    }

    ?>


    and later i put this to display the name of the albums, description and thumbnail

    <?
    $result=mysql_query("SELECT * FROM plogger_albums ORDER BY id DESC LIMIT 0,5",$conn);

    while($reg=mysql_fetch_array($result)) {
    $result2=mysql_query("SELECT * FROM `plogger_pictures` WHERE parent_album='".$reg['id']. "' ORDER BY id;",$conn);
    $reg2=mysql_fetch_assoc($result2);
    ?>
    </h4>

    <div class="ultimos"> <a href="/galeria/index.php?level=album&amp;id=<?=$reg['id']?>"><img src="/galeria/thumbs/<?=$reg2["id"]."-".basename($reg2["path"])?>" alt="<?=$reg['name']?>" /></a>

    <p></p>

    <h4><a href="/galeria/index.php?level=album&amp;id=<?=$reg['id']?>">
    <?=$reg['name']?>
    </a></h4>

    <p><a href="/galeria/index.php?level=album&amp;id=<?=$reg['id']?>">
    <?=$reg['description']?>
    </a></p>
    <p></p>
    </div>
    <p>
    <?
    }
    mysql_free_result($result);
    ?>


    In this new version of plogger it doesnt work! the name and description works fine but not the thumbnail... Any ideas about it? Plzz

    P.s Sorry for my bad english