Image Deleted
";
}else{
echo "Image Delete Error
";
}
}
}
//validate file ext
function getExtension($str) {
$i = strrpos($str,'.');
if (!$i) { return ''; }
$l = strlen($str) - $i;
$ext = substr($str,$i+1,$l);
return $ext;
}
//create thumbs function
function createThumbs( $pathToImages, $pathToThumbs, $thumbWidth )
{
// open the directory
$dir = opendir( $pathToImages );
// loop through it, looking for any/all JPG files:
while (false !== ($fname = readdir( $dir ))) {
// parse path for the extension
$info = pathinfo($pathToImages . $fname);
// continue only if this is a JPEG image
if ( @strtolower($info['extension']) == 'jpg' or @strtolower($info['extension']) == 'jpeg' or @strtolower($info['extension']) == 'jpe')
{
// echo "Created thumbnail for - {$fname}
";
// load image and get image size
$img = imagecreatefromjpeg( "{$pathToImages}{$fname}" );
$width = imagesx( $img );
$height = imagesy( $img );
// calculate thumbnail size
$new_width = $thumbWidth;
$new_height = floor( $height * ( $thumbWidth / $width ) );
// create a new temporary image
$tmp_img = imagecreatetruecolor( $new_width, $new_height );
// copy and resize old image into new image
imagecopyresized( $tmp_img, $img, 0, 0, 0, 0, $new_width, $new_height, $width, $height );
// save thumbnail into a file
imagejpeg( $tmp_img, "{$pathToThumbs}{$fname}" );
}
}
// close the directory
closedir( $dir );
}
$submited='';
if($allowUpload) {
if(isset($_POST['submit2']) && !empty($_POST['submit2']))
{
$submited='yes';
$path = $dirpath; //Folder where uploaded files go
if (is_uploaded_file($_FILES['userfile']['tmp_name'])) {
if ((($_FILES["userfile"]["type"] == "image/gif")
|| ($_FILES["userfile"]["type"] == "image/jpg")
|| ($_FILES["userfile"]["type"] == "image/jpe")
|| ($_FILES["userfile"]["type"] == "image/gif")
|| ($_FILES["userfile"]["type"] == "image/jpeg"))
&& ($_FILES["userfile"]["size"] < $maxsize))
{
$filename = stripslashes($_FILES['userfile']['name']);
//get the extension of the file in a lower case format
$extension = getExtension($filename);
$extension = strtolower($extension);
//if it is not a known extension, we will suppose it is an error and will not upload the file,
//otherwise we will do more tests
//echo $extension;
if ($extension == "jpg" or $extension == "jpeg" or $extension == "gif")
{
$pass="1";
}else{
//print error message
echo '
$thelist
"; echo '"; echo ""; echo " |