Jump to content

Resize on download


gerkintrigg

Recommended Posts

I'm trying to work out how to re-size an image before it's downloaded.

 

I've worked out how to force a download and hide the original file:

 

<?php // start the session 
session_start(); 
$root='../';
header("Cache-control: private"); //IE 6 Fix 
include $root.'includes/db.php';

if ($_SESSION['Logged_In']=='Yes'){
//check the number of credits available:
$points=mysql_fetch_array(mysql_query("SELECT Points FROM member WHERE userid=".$_SESSION['my_id']));
$points=$points['Points'];

if ($points>=3){
	header("Content-Type: image/jpg");
	header("Content-Disposition: image; filename=image.jpg");
	//includes/imgsize.php?w=400&h=400&constrain=1&img=http://www.nextdaygraphics.com/'.$item['watermarked_img']
	readfile("../".$_SESSION['item_img_url']);
	mysql_query("UPDATE `member` SET `Points` = (`Points`-3) WHERE `userid` =".$_SESSION['my_id']." LIMIT 1 ;");
}
else{
	$go='http://www.nextdaygraphics.com/buy_credits.php';
	header('Location:'.$go);
}
}
else{
$go='http://www.nextdaygraphics.com/buy_credits.php';
header('Location:'.$go);
}
?>

 

I just have no idea how to resize it. I have a function that does it via the URL, but it's not working for this function (no errors displayed though).

 

any ideas?

Link to comment
https://forums.phpfreaks.com/topic/60971-resize-on-download/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.