[thelist] Web-Based Hidden Image Optimization

Rob Smith rob.smith at THERMON.com
Mon Jan 24 09:23:48 CST 2005


> you can do that with either Imagemagick or the GDI libraries in PHP
> http://www.imagemagick.org/
> http://uk.php.net/gd

Cool! I'll have to check that out.

> but you can't stop them uploading a large file in the first place. 

On the contrary...
from the form:
<form method="post" name="whatever" action="page.php"
enctype="multipart/form-data">
<input type="file" name="ProductPicture" size="12">
<input type="hidden" name="MAX_FILE_SIZE" value="4194304" />
</form>

from the parsing page:
$disk_quota = mysql_result($results_file,0,"CustDiskQuota");
if (($_FILES['ProductPicture']['size'] + $disk_quota) >
$_POST["MAX_FILE_SIZE"]) {
  unlink($uploaddir . $ProductPicture);
  // where $ProductPicture = aboslute path to image itself
  // stop right here; quota exceeded. delete if uploaded.
exit;

:-) cool stuff

Rob


More information about the thelist mailing list