Page 1 of 1

Outputting Files

Posted: Sat Oct 29, 2005 6:35 am
by Ralle
Read Last post

Posted: Sat Oct 29, 2005 6:42 am
by feyd
images are sent via a separate stream from the HTML. You need a separate script that pulls the image and resizes it.. I'd suggest storing the resized image because the resampling process is computationally heavy and takes a while. Your page serving rate will severly drop if you don't..

Posted: Sat Oct 29, 2005 12:44 pm
by Ralle
okay
let's say I have an image uploading script. How would I do to resize it, and store it.. I searched php.net but couldn't find anything

Posted: Sat Oct 29, 2005 12:47 pm
by feyd
the second argument to imagejpeg() is the filename to save the image as.

Posted: Sat Oct 29, 2005 2:01 pm
by Ralle
OK now I need some download script. I have been trying to find a working script for so long. I just need a small script that handles a file to download. could be like: download($filename) very simple :)
I want it o hide the filepath

Posted: Sat Oct 29, 2005 2:55 pm
by Ralle
this is my script so far:

Code: Select all

<?
// standard hack prevent 
define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);

$id = $_GET['id'];
$result = mysql_query("SELECT * FROM maps WHERE maps_id='$id'");
while ($row = mysql_fetch_array($result))

$filename = 'maps/' . $row['maps_file'];

$file = fopen($filename, 'r'); 

//set some HTTP headers 
Header('Content-Type: application/x-octet-stream'); 
Header('Content-Transfer-Encoding: binary'); 
Header('Content-Length: ' . filesize($filename)); 
Header('Cache-Control: no-cache, must-revalidate'); //HTTP 1.1 
Header('Cache-Control: post-check=0, pre-check=0', false); //HTTP 1.1 
Header('Pragma: no-cache'); //HTTP 1.0 
Header('Content-Description: Whatever the file is'); 
Header('Content-Disposition: attachment; filename="'.$filename.'"'); 
Header('Title: ' .$filename()); 

while(!$feof($file)) 
     print(fread($file, 4096)); 

fclose($file); 

?>
it outputs:
Fatal error: Call to undefined function: maps/(6)dragonfire.w3m() in /home/hivework/public_html/forum/downloadmap.php on line 25