make a link to a open a "save as" dialog instead of the image opening in a new window.
  • I would like a link to an image structure make the user download the image instead of the default result which is opening it in a new window.

  • 4 Answers sorted by
  • Vote Up0Vote Down KevinKevin September 2010

    Use the <v:file> tag:

  • The problem with that is I need to use the imagesize attribute to specify a crop size.

    Does the Vae sever allow for php header() functions to be used? I was thinking of trying something like this (for a jpeg)

    The url would be


    $file = $_GET['file'];

    echo $file;

    die('Error: File not found.');
    // Set headers
    header("Cache-Control: public");
    header("Content-Description: File Transfer");
    header("Content-Disposition: attachment; filename=$file");
    header("Content-Type: image/jpg");
    header("Content-Transfer-Encoding: binary");

    // Read the file from disk

  • Vote Up0Vote Down KevinKevin September 2010

    You could certainly do this. You might need to call this function at the top of your script to ensure that Vae doesn't mess you up:


    That will prevent Vae from trying to touch your output in any way.

  • It worked! For reference:


    $filename = $_REQUEST['file'];
    $img = array_pop(parse_url($filename));

    header('Content-disposition: attachment; filename=' . $filename .'');
    header('Content-type: image/jpg');


Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In Apply for Membership

In this Discussion