hey all
I’m using the [URL=”http://www.pixeline.be/experiments/jqUploader/setup.php”]jqUploader
However I’d like to restrict the uploaded images to a size of 500px x 300px (width x height)
I know it involves the use of getimagesize() but I’m a very amateur phpr and have no idea where or how to insert it into the following code…
[code=php]<?php
$uploadDir = dirname(__FILE__) . ‘/images/hq/’;
$uploadFile = $uploadDir . basename($_FILES[‘Filedata’][‘name’]);
if ($_POST[‘submit’] != ”) {
// 1. submitting the html form
if (!isset($_GET[‘jqUploader’])) {
// 1.a javascript off, we need to upload the file
if (move_uploaded_file ($_FILES[0][‘tmp_name’], $uploadFile)) {
// delete the file
// @unlink ($uploadFile);
$html_body = ‘<h1>File successfully uploaded!</h1>’;
} else {
$html_body = ‘<h1>File upload error!</h1>’;
switch ($_FILES[0][‘error’]) {
case 1:
$html_body .= ‘The file is bigger than this PHP installation allows’;
break;
case 2:
$html_body .= ‘The file is bigger than this form allows’;
break;
case 3:
$html_body .= ‘Only part of the file was uploaded’;
break;
case 4:
$html_body .= ‘No file was uploaded’;
break;
default:
$html_body .= ‘unknown errror’;
}
$html_body .= ‘File data received.’;
}
$html_body = ‘Image uploaded. Check your HQ page.<br>You will need to go to a different calendar and back again to see a change.’;
} else {
// 1.b javascript on, so the file has been uploaded and its filename is in the POST array
$html_body = ‘Error’;
}
myHtml($html_body);
} else {
if ($_GET[‘jqUploader’] == 1) {
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// 2. performing jqUploader flash upload
if ($_FILES[‘Filedata’][‘name’]) {
if (move_uploaded_file ($_FILES[‘Filedata’][‘tmp_name’], $uploadFile)) {
// delete the file
// @unlink ($uploadFile);
return $uploadFile;
}
} else {
if ($_FILES[‘Filedata’][‘error’]) {
return $_FILES[‘Filedata’][‘error’];
}
}
}
}
// /////////////////// HELPER FUNCTIONS
function myHtml($bodyHtml)
{
echo $bodyHtml;
}
?>
thanks in advance