Forum Moderators: coopster
Here is what Im trying to do in a nut shell. I have a page where many drop and drag images are pulled into one table to create one big picture. Once the final picture is created I would like to add a "download image" button which of course would prompt the user to save the image to there computer.
I've seen this done on a similar site before but I do not have a clue how to incorporate this option. I imagine a forced file downloader is used, But I esp can not figure out how the newly created un named image within the table would be called into such a script.
Can anyone help me?
Thank you,
Gabby
1) have a good read up about GD ( [php.net...] ) and ImageMagick ( [imagemagick.org...] ) and you can use PHP to pull all these images together, make a temp file and send it to the browser for download
Or (and I think this is easier from a coder's and UI point of view)
2) use Flash! Flash is great for building great UIs and interactions, and I've created many UIs (in and out of the web) where image creation has been key.
[edited by: coopster at 2:09 pm (utc) on Aug. 9, 2007]
[edit reason] linked urls, removed non-authoritative url [/edit]
<?php
// Forces files to be downloaded instead of simply being displayed in the browser.
$filename = $_GET['file'];
// required for IE, otherwise Content-disposition is ignored
if(ini_get('zlib.output_compression'))
ini_set('zlib.output_compression', 'Off');
// addition by Jorg Weske
$file_extension = strtolower(substr(strrchr($filename,"."),1));
if( $filename == "" )
{
echo "<html><title>Download Script</title><body>ERROR: download file NOT SPECIFIED. USE forcedownload.php?file=filepath</body></html>";
exit;
} elseif (! file_exists( $filename ) )
{
echo "<html><title>Download Script</title><body>ERROR: File not found. USE forcedownload.php?file=filepath</body></html>";
exit;
};
header("Pragma: public"); // required
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private",false); // required for certain browsers
header("Content-Type: application/force-download");
// change, added quotes to allow spaces in filenames, by Rajkumar Singh
header("Content-Disposition: attachment; filename=\"".basename($filename)."\";" );
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".filesize($filename));
readfile("$filename");
exit();
?>