Not signed in (Sign In)

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

    • CommentAuthorlxmarcel
    • CommentTimeSep 7th 2008
     
    Can i put a download link next to the thumbnail to get the original high resolution file?
    Thank you in advance.
    •  
      CommentAuthormemic.a
    • CommentTimeSep 8th 2008 edited
     
    Hi

    Do you want a download button like this that I have in my gallery ?

    I modified the default print button into the download button.

    Add this function to plog-functions.php

    function plogger_download_button() {
    global $config;
    $id = $GLOBALS["plogger_id"];

    if ($GLOBALS['plogger_level'] == "picture") {
    return '<a class="download" href="'.$config['gallery_url'].'download.php?image='.SmartStripSlashes($GLOBALS["current_picture"]["path"]).'" title="Download">Download</a>';
    }
    }


    and create a file named download.php and put it in the plogger folder

    Paste this code to download.php file
    <?
    if(!isset($_GET['image']))
    {
    echo "Nothing to see here. <br />";
    exit;
    }



    $file = 'images/'.$_GET['image'];
    $file = str_replace("../","",$file);

    if (file_exists($file))
    $path_parts = pathinfo($file);
    if (isset($path_parts['extension']) )
    $ext = $path_parts['extension'];
    else
    $ext='';

    #allow only images for download
    if(!in_array(strtolower($ext),array("jpg","gif","png","bmp","jpeg"))) exit;

    header("Content-type: application/$ext");
    header("Content-Transfer-Encoding: Binary");
    header("Content-length: ".filesize($file));
    header("Content-disposition: attachment; filename=\"".basename($file)."\"");

    readfile ("$file");
    ?>
    Thankful People: lxmarcel
    • CommentAuthorlxmarcel
    • CommentTimeSep 8th 2008
     
    Yes! Same like yours! Thank you very much for your help.
    I will try it asap. You just saved my day.