예제 #1
0
 $rec_email = $_POST["rec_email"];
 $rec_web = $_POST["rec_web"];
 //uploading company logo
 $target_path = "";
 $target_path = "../../recruiter/logos/";
 $base_name = "";
 if (isset($_FILES["comp_logo"]) && $_FILES["comp_logo"]["name"] != "") {
     $base_name = basename($_FILES["comp_logo"]["name"]);
     $base_name_arr = explode(".", $base_name);
     $base_ext = end($base_name_arr);
     $base_name = $_POST['comp_name'] . "_" . $_POST['rec_phone'] . "." . $base_ext;
     $target_path = $target_path . $base_name;
     if (move_uploaded_file($_FILES["comp_logo"]["tmp_name"], $target_path)) {
         $imgInfo = getimagesize($target_path);
         if ($imgInfo[0] > 180 || $imgInfo[1] > 80) {
             createthumb($target_path, $target_path, 180, 80);
         }
         $comp_logo = $base_name;
     }
 } else {
     if (isset($_POST["hid_comp_logo"]) && $_POST["hid_comp_logo"] != "") {
         $comp_logo = $_POST["hid_comp_logo"];
     }
 }
 if (isset($_POST["rec_hidename"])) {
     $rec_hidename = $_POST["rec_hidename"];
 }
 if (isset($_POST["rec_hideaddress"])) {
     $rec_hideaddress = $_POST["rec_hideaddress"];
 }
 if (isset($_POST["rec_hideemail"])) {
                         $imageNewValue = JPATH_ROOT . '/' . $copyPath . $cleanFileName;
                         imagejpeg(icImageCreateFromBMP($imageNewValue), JPATH_ROOT . '/' . $copyPath . $cleanTitle . '.jpg', 100);
                         unlink($imageNewValue);
                     }
                 } else {
                     $linkToImage = $imageValue;
                 }
             } else {
                 imagejpeg(icImageCreateFromBMP(JPATH_ROOT . '/' . $imageValue), JPATH_ROOT . '/' . $copyPath . $cleanTitle . '.jpg', 100);
             }
             $imageValue = $copyPath . $cleanTitle . '.jpg';
             $linkToImage = JPATH_ROOT . '/' . $imageValue;
             if (!$fopen) {
                 $fopen_bmp_error_msg = true;
             } elseif (url_exists($linkToImage) or file_exists($linkToImage)) {
                 createthumb($linkToImage, JPATH_ROOT . '/' . $Thumb_Link, $thumb_width, $thumb_height, $thumb_quality);
             } else {
                 $Invalid_Link = true;
             }
         }
     } else {
         if (url_exists($linkToImage) or file_exists($linkToImage)) {
             $Invalid_Img_Format = true;
         } else {
             $Invalid_Link = true;
         }
     }
     if (!$Invalid_Link) {
         $Display_Thumb = true;
     }
 } else {
<?php

if ($_GET["folder"] && (substr($_GET["folder"], 0, 1) == "." || preg_match("/.+\\.\\..+/", $_GET["folder"]))) {
    echo "no no no.";
    return;
}
$imagefolder = $_SERVER["DOCUMENT_ROOT"] . "/images/" . $_GET["folder"];
$thumbsfolder = $_SERVER["DOCUMENT_ROOT"] . "/thumbs/" . $_GET["folder"];
$pics = directory($imagefolder, "jpg,JPG,JPEG,jpeg,png,PNG,gif,GIF");
$pics = ditchtn($pics, "tn_");
if (!file_exists($thumbsfolder)) {
    mkdir($thumbsfolder);
}
if ($pics[0] != "") {
    foreach ($pics as $p) {
        createthumb($p, "tn_" . $p, 150, 150);
    }
}
/*
	Function ditchtn($arr,$thumbname)
	filters out thumbnails
*/
function ditchtn($arr, $thumbname)
{
    foreach ($arr as $item) {
        if (!preg_match("/^" . $thumbname . "/", $item)) {
            $tmparr[] = $item;
        }
    }
    return $tmparr;
}
예제 #4
0
             }
             $result = dbquery("update " . DB_USERS . " set {$set_avatar} where user_id='" . $userdata['user_id'] . "'");
             if ($result) {
                 redirect(FUSION_SELF . "?section=avatar&status=updated");
             }
         } elseif (isset($_POST['avatarWeb']) && $_POST['avatarWeb'] !== "http://www.") {
             if (verify_image(stripinput($_POST['avatarWeb']))) {
                 $avatarname = strrchr(stripinput($_POST['avatarWeb']), "/");
                 $avatarname = str_replace("/", "", $avatarname);
                 $avatarext = strrchr($avatarname, ".");
                 $avatarname = substr($avatarname, 0, strrpos($avatarname, "."));
                 if (preg_match("/^[-0-9A-Z_\\[\\]]+\$/i", $avatarname) && preg_match("/(\\.gif|\\.GIF|\\.jpg|\\.JPG|\\.jpeg|\\.JPEG|\\.png|\\.PNG)\$/", $avatarext)) {
                     $avatarname = $avatarname . "[" . $userdata['user_id'] . "]" . $avatarext;
                     $image = stripinput($_POST['avatarWeb']);
                     copy($image, INFUSIONS . "fusionboard4/images/avatarst/" . $avatarname);
                     createthumb(INFUSIONS . "fusionboard4/images/avatarst/" . $avatarname, IMAGES . "avatars/" . $avatarname, $fb4['avatar_max_w'], $fb4['avatar_max_h']);
                     unlink(INFUSIONS . "fusionboard4/images/avatarst/" . $avatarname);
                     $result = dbquery("update " . DB_USERS . " set user_avatar='{$avatarname}' where user_id='" . $userdata['user_id'] . "'");
                     redirect(FUSION_SELF . "?section=avatar&status=updated");
                 } else {
                     redirect(FUSION_SELF . "?section=avatar");
                 }
             } else {
                 redirect(FUSION_SELF . "?section=avatar");
             }
         }
     }
 }
 echo "<form action='" . FUSION_SELF . "?section=avatar' method='post' name='profileForm' enctype='multipart/form-data'>\n";
 if (isset($_GET['status']) && $_GET['status'] == "updated") {
     echo "<tr>\n<td class='tbl1' style='padding:20px; text-align:center; font-weight:bold;'>" . $locale['uc214'] . "</td>\n</tr>\n";
예제 #5
0
require '../../extras/Uploader.php';
require_once '../../../../configuracao_servidor.php';
// Directory where we're storing uploaded images
// Remember to set correct permissions or it won't work
//$upload_dir = dirname(__FILE__) . '/upload_files/';
//$upload_dir = $_SERVER['DOCUMENT_ROOT'] . '/tcc/images/uploads/logos/';
ini_set('post_max_size', '64M');
ini_set('upload_max_filesize', '64M');
//Path para o endereco base do servidor
if ($_SERVER["REMOTE_ADDR"] == '127.0.0.1') {
    $server_root = $_SERVER["DOCUMENT_ROOT"] . '/tcc/';
} else {
    $server_root = $pasta_upload;
    // vem do arquivo de configuracao do servidor
}
$upload_dir = $server_root . '/images/uploads/logos/';
$uploader = new FileUpload('uploadfile');
$novo_nome = md5(uniqid(rand(), true)) . '.' . $uploader->getExtension();
$uploader->newFileName = $novo_nome;
// Handle the upload
$result = $uploader->handleUpload($upload_dir);
if (!$result) {
    exit(json_encode(array('success' => false, 'msg' => $uploader->getErrorMsg())));
}
require_once $server_root . '/libs/Model/Miniatura.php';
$pasta = $upload_dir;
$img_name = $novo_nome;
createthumb($pasta . $img_name, $pasta . 'small/' . $img_name, 320, 320, false, true, false);
createthumb($pasta . $img_name, $pasta . 'medium/' . $img_name, 720, 720, false, true, false);
createthumb($pasta . $img_name, $pasta . 'large/' . $img_name, 1000, 1000, false, true, false);
echo json_encode(array('success' => true, 'img' => $uploader->newFileName));
예제 #6
0
        }
    }
    if (!empty($log_action)) {
        $imgpath = NV_ROOTDIR . '/' . NV_UPLOADS_DIR . '/' . $module_name . '/' . $catdata['image'];
        $thumbpath = NV_ROOTDIR . '/' . NV_UPLOADS_DIR . '/' . $module_name . '/thumbs/category/';
        if (!is_dir(NV_UPLOADS_REAL_DIR . '/' . $module_name . '/category/' . $catdata['alias'])) {
            nv_mkdir(NV_UPLOADS_REAL_DIR . '/' . $module_name . '/category/', $catdata['alias']);
            nv_loadUploadDirList(false);
        }
        if (!is_dir(NV_UPLOADS_REAL_DIR . '/' . $module_name . '/category/' . $catdata['alias'] . '/thumbs')) {
            nv_mkdir(NV_UPLOADS_REAL_DIR . '/' . $module_name . '/category/' . $catdata['alias'] . '/', 'thumbs');
            nv_loadUploadDirList(false);
        }
        $catdata['imgfolder'] = strtolower($catdata['alias']);
        if ($catdata['image'] != '' and !file_exists($thumbpath . '/' . $catdata['image'])) {
            $catdata['thumbpath'] = createthumb($imgpath, $thumbpath, '', 80, 80);
        }
        $np->updateItem('category', $catdata, 'catid');
        nv_fix_cat_order();
        nv_insert_logs(NV_LANG_DATA, $module_name, $log_action, $catdata['title'], $admin_info['userid']);
    }
    nv_del_moduleCache($module_name);
    if (empty($np->error) and empty($np->warning)) {
        //Header( "Location: " . NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=" . $op );
        //die();
        $np->success[] = "Lưu chủ đề thành công";
        $np->status();
        //redriect ( "", NV_BASE_ADMINURL . "index.php?" . NV_NAME_VARIABLE . "=" . $module_name . "&" . NV_OP_VARIABLE . "=" . $op );
    }
}
$cats['groups_view'] = explode(",", $cats['groups_view']);
 public function uploadimg()
 {
     $config = array('maxSize' => 3145728, 'rootPath' => THINK_PATH, 'savePath' => './Public/Uploads/', 'saveName' => array('uniqid', ''), 'exts' => array('jpg', 'gif', 'png', 'jpeg'), 'autoSub' => true, 'subName' => array('date', 'Ymd'));
     $info = $this->upload($config);
     if (!$info) {
         // 上传错误提示错误信息
         $this->error($upload->getError());
     } else {
         // 上传成功
         $formname = trim($_POST['formname']);
         $editname = trim($_POST['editname']);
         $savepath = str_replace("./", "/", $info['img']['savepath']);
         dump($savepath);
         $savepath = "/" . pathconvert($_SERVER['DOCUMENT_ROOT'], THINK_PATH) . $savepath . $info['img']['savename'];
         //表单数据获取验证
         $savepath = str_replace("//", "/", $savepath);
         dump($savepath);
         $filepath = $config['rootPath'] . str_replace("./", "/", $info['img']['savepath']);
         $filepath = $filepath . $info['img']['savename'];
         // $image = new \Think\Image();
         // $image->open($filepath);
         $thumb_savepath = createthumb($filepath, $savepath, 100, 100);
         //str_replace(".jpg","_thumb.jpg",$filepath);
         //$image->thumb(150,150)->save($thumb_savepath);
         echo "<script>window.opener.document." . $formname . "." . $editname . ".value='" . $savepath . "'</script>";
         //这一句改变了它的值;
         echo "<script>window.opener.document." . $formname . ".thumb_" . $editname . ".value='" . $thumb_savepath . "'</script>";
         //这一句改变了它的值;
         echo "<script>alert('success');window.close();</script>";
     }
 }
예제 #8
0
파일: phpGD.php 프로젝트: ritarafaeli/notes
	
</head>

<body>

	<a href='/classes/viewSource/?path=<?php 
echo $_SERVER['PHP_SELF'];
?>
' target='_blank'>View Source</a> | 
	<a href='/classes/viewSource/?path=http://susanbuck.net/classes/code/phpGD/phpGD_functions.php' target='_blank'>View Source of phpGD_functions.php</a><br/><br/><br/>

	<?php 
# Params
$image = "puppy.jpg";
# Display the image
echo $image . "<br/>";
echo "<img src='" . $image . "'/><br/>";
# Print dimensions of image
echo getDimensions($image);
# Resize image to a thumb
$newThumb = createthumb($image, "littlePuppy", 100, 100);
# Write on the thumb
writeOnImage($newThumb, "Puppy!");
# Display the thumb
echo "Resulting thumb:<br/>";
echo "<img src='" . $newThumb . "'/>";
?>

</body>
</html>
예제 #9
0
파일: crop.php 프로젝트: sandesh5b/imgcrop
$imgSize = file_put_contents($source_image, file_get_contents($img));
if ($imgSize) {
    $dest_image = __DIR__ . "/{$size}/{$fileName}[{$imgSize}].{$ext}";
    if (file_exists($dest_image)) {
        output_img($dest_image, $ext);
        exit;
    }
} else {
    exit;
}
//-------------------------------------------------------------------
if (is_int($width) && is_int($height) && file_exists($source_image)) {
    if (!file_exists(__DIR__ . "/{$size}/")) {
        mkdir(__DIR__ . "/{$size}/", 0777, true);
    }
    createthumb($source_image, $dest_image, $width, $height);
    if (file_exists($dest_image)) {
        output_img($dest_image, $ext);
        exit;
    }
}
//-------------------------------------------------------------------
function output_img($img, $ext)
{
    $fp = fopen($img, 'rb');
    // send the right headers
    header("Content-Type: image/{$ext}");
    header("Content-Length: " . filesize($img));
    // dump the picture and stop the script
    fpassthru($fp);
}
예제 #10
0
 function uploadimage($company_id, $file, $tmp_filename, $type = 0)
 {
     //filename mangling
     $file = date('U') . '_' . $file;
     $file_location = $_SERVER['DOCUMENT_ROOT'] . "/../files/company_logos/{$company_id}/{$file}";
     // create a directory for every user_id
     $resized_img_path = $_SERVER['DOCUMENT_ROOT'] . "/../files/company_logos/{$company_id}/th_{$file}";
     // create a directory for every user_id
     $new_size = getNewDimensions($tmp_filename);
     //	$this->_createUserFilesFolder($type);
     $this->_createCompanyFilesFolder($company_id);
     // move the file and link it to the artifact
     if (move_uploaded_file($tmp_filename, $file_location)) {
         createthumb($file_location, $resized_img_path, $new_size['new_width'], $new_size['new_height']);
         if ($this->addCompanyLogo($company_id, $file, $type)) {
             return true;
         } else {
             return false;
         }
     }
 }
예제 #11
0
function changefolder($ordner)
{
    global $folders, $tnwidth, $gmwidth, $gdlibchecked;
    // set initial variable $ordner
    if (!isset($ordner)) {
        $ordner = $folders['previews'][0]->dir->src;
    }
    $ordner = '../../' . $ordner;
    $files_to_zip = array();
    // scanning directories for image files
    if (is_dir($ordner)) {
        $dirhandle = opendir($ordner);
        $images = array();
        $gdlibchecked = false;
        while ($filename = readdir($dirhandle)) {
            if (!isdot($filename) && is_file($ordner . '/' . $filename) && isvalidfiletype($filename)) {
                // image data
                $thumbnail = changetoroot($ordner . '/thumbnails/tn_' . $filename);
                $image = new Path($filename, changetoroot($ordner . '/' . $filename));
                $files_to_zip[] = $ordner . '/' . $filename;
                $exif = null;
                // extract exif data
                $gps = getGPS($ordner . '/' . $filename);
                if (isset($gps)) {
                    $gmthumbnail = changetoroot($ordner . '/thumbnails/gm_' . $filename);
                    $exif = new Exif($gps, null, $gmthumbnail);
                }
                array_push($images, new Image($image, $thumbnail, $exif));
                // create thumbs if necessary
                createthumb($ordner, 'tn', $filename, $tnwidth);
                createthumb($ordner, 'gm', $filename, $gmwidth);
            }
        }
        sort($images);
        $dir = new Path(preg_replace('/^(.+\\/)*/', '', $ordner), $ordner);
        closedir($dirhandle);
    } else {
        return null;
    }
    $gallery = new Gallery($images, $dir);
    create_zip($files_to_zip, '../../' . $gallery->download);
    return $gallery;
}
예제 #12
0
 public function uploadRecipeImage($recipe_id, $file, $tmp_filename, $type = 0)
 {
     //filename mangling
     $file = $recipe_id . '_' . $file;
     $file_location = $_SERVER['DOCUMENT_ROOT'] . "/images/category_banners/{$file}";
     // create a directory for every user_id
     $resized_img_path = $_SERVER['DOCUMENT_ROOT'] . "/images/category_banners/th_{$file}";
     // create a directory for every user_id
     $new_size = getNewDimensions($tmp_filename);
     if (move_uploaded_file($tmp_filename, $file_location)) {
         createthumb($file_location, $resized_img_path, $new_size['new_width'], $new_size['new_height']);
         if ($this->addRecipeImage($recipe_id, $file)) {
             return true;
         } else {
             return false;
         }
     }
 }
예제 #13
0
<!-- OKTOSHOW -->
<a href='/classes/viewSource/?path=<?php 
echo $_SERVER['PHP_SELF'];
?>
' target='_blank'>View Source</a><br/>
 
<title>uploaderExample_process.php</title> 
 
<?php 
require_once $_SERVER['DOCUMENT_ROOT'] . "/classes/code/phpGD/uploaderExample_functions.php";
# When debugging we can print our array of upload variables
#print_r($_FILES)."<br/><br/>";
# From the FILES array find out what the name of our file is. Basename will extract just the name.
$fileName = basename($_FILES['fileUploader']['name']);
# Specify where we want to file to be uploaded to
$uploadTo = "uploads/" . $fileName;
# Find out what the temporary name is - this is set by the server and we'll need it to move it
$tempFileName = $_FILES['fileUploader']['tmp_name'];
# To upload means just moving the temporary file to a specific space on our server
if (move_uploaded_file($tempFileName, $uploadTo)) {
    echo "<br/><br/>Successfully uploaded {$uploadTo} <br/><br/>";
    # Create thumb
    $thumb = createthumb($fileName, 100, 100);
    echo "Successfully created thumb ({$thumb}):<br/> <img src='uploads/{$thumb}'>";
} else {
    echo "<br/><br/>Error uploading {$fileName}";
}
?>

<br/><br/><a href='uploaderExample.php'>Go back to uploader</a>
예제 #14
0
<?php

require "config/site_dir.php";
require "thumbnail_generator.php";
//ini_set("memory_limit", "6M");
if (createthumb("10.jpg", "thumb_10", 100, 100)) {
    echo "klart";
} else {
    echo "fel";
}
?>




 if (!empty($value['Title'])) {
     echo '<div class="modtitle"><h5><a href="' . $value['URL'] . '">' . $value['Title'] . '</a></h5></div>';
 }
 if (!empty($value['Thumbnail']['localName'])) {
     $thumbWidth = 120;
     $thumbHeight = 120;
     $localName = $value['Thumbnail']['localName'];
     $file = getFullURLFromFileName($localName);
     $image = getThumbURLFromFileName($localName);
     //getThumbnailKORA($value['Thumbnail']['localName'], $thumbWidth, $thumbHeight);
     // Get thumb from KORA
     echo '<a href="' . $value['URL'] . '"><img class="moduleImg" width="' . $thumbWidth . '" height="' . $thumbHeight . '"  src="' . $image . '" alt="' . htmlChars($value['Title']) . '" /></a><br />';
 } else {
     //Create thumb if needed
     if (!empty($hi_obj['Image']['localName'])) {
         createthumb(getFullPathFromFileName($value['Image']['localName']), 'thumbs/' . $value['Image']['localName'], 100, 100);
         echo '<a href="' . $value['URL'] . '"><img src="' . baseURL . 'thumbs/' . $value['Image']['localName'] . '" alt="' . htmlChars($value['Title']) . '" /></a><br />';
     }
 }
 if (!empty($value['Date'])) {
     foreach ($value['Date'] as $date) {
         if (!empty($date)) {
             if ($date == "CE") {
                 break;
             }
             echo $date . "<br/>";
         }
     }
 }
 if (!empty($value['Description'])) {
     echo fixTags($value['Description']) . "<br />";
예제 #16
0
    $second = 'catid';
    $condition = 'listalbid';
}
$np->CheckAdminAccess($condition, $typeid);
if ($np->status() == false) {
    die('nperror*You cannot access this action');
}
require_once NV_ROOTDIR . "/includes/class/upload.class.php";
$upload = new upload($admin_info['allow_files_type'], $global_config['forbid_extensions'], $global_config['forbid_mimes'], NV_UPLOAD_MAX_FILESIZE, NV_MAX_WIDTH, NV_MAX_HEIGHT);
if (is_uploaded_file($_FILES['file']['tmp_name'])) {
    $upload_info = $upload->save_file($_FILES['file'], NV_ROOTDIR . '/' . NV_UPLOADS_DIR . '/' . $module_name . '/' . $type . '/' . $data[$typeid]['imgfolder'], false);
    if (empty($upload_info['error'])) {
        $imgpath = NV_ROOTDIR . '/' . NV_UPLOADS_DIR . '/' . $module_name . '/' . $type . '/' . $data[$typeid]['imgfolder'] . '/' . $upload_info['basename'];
        $thumbpath = NV_ROOTDIR . '/' . NV_UPLOADS_DIR . '/' . $module_name . '/' . $type . '/' . $data[$typeid]['imgfolder'] . '/thumbs/';
        if (!file_exists($thumbpath . '/' . $upload_info['basename'])) {
            $imgdata['thumbpath'] = createthumb($imgpath, $thumbpath, '', 180, 180);
        }
        $src = NV_BASE_SITEURL . NV_UPLOADS_DIR . '/' . $module_name . '/' . $type . '/' . $data[$typeid]['imgfolder'] . '/' . $upload_info['basename'];
        $lu = strlen('.' . $upload_info['ext']);
        $alias = substr($upload_info['basename'], 0, -$lu);
        $alias = np_get_alias('photos', 0, $alias);
        $imgdata['pid'] = 'NULL';
        $imgdata['filename'] = $upload_info['basename'];
        $imgdata['filetype'] = $upload_info['mime'];
        $imgdata['filepath'] = $type . '/' . $data[$typeid]['imgfolder'];
        $imgdata[$main] = intval($typeid);
        $imgdata[$second] = 0;
        $imgdata['alias'] = $imgdata['title'] = $alias;
        $imgdata['img_size'] = $upload_info['img_info'][0] . '-' . $upload_info['img_info'][1];
        $pid = $np->addItem('photos', $imgdata);
        if ($type == 'category' and $pid > 0) {
예제 #17
0
        imagepng($new_img);
        $img = ob_get_contents();
        ob_end_clean();
        $return = base64_encode($img);
    } else {
        if ($ext == "jpeg" || $ext == "jpg") {
            header('Content-Type: image/jpeg');
            imagejpeg($new_img);
            $return = true;
        } elseif ($ext == "png") {
            header('Content-Type: image/png');
            imagepng($new_img);
            $return = true;
        }
    }
    imagedestroy($new_img);
    imagedestroy($img);
    return $return;
}
if (!isset($_GET['i']) || !isset($_GET['w']) && !isset($_GET['h'])) {
    die;
}
if (!file_exists($_GET['i'])) {
    die;
}
$file = urldecode($_GET['i']);
list($fullWidth, $fullHeight) = getimagesize($file);
$w = isset($_GET['w']) ? $_GET['w'] : $fullWidth * ($_GET['h'] / $fullHeight);
$h = isset($_GET['h']) ? $_GET['h'] : $fullHeight * ($_GET['w'] / $fullWidth);
createthumb($file, $w, $h);
예제 #18
0
        // Allow certain file formats
        if ($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif") {
            $uploadOk = 0;
        }
        // Check if $uploadOk is set to 0 by an error
        if ($uploadOk == 0) {
            $respond = array('success' => false);
            echo json_encode($respond);
            $dbConnect = new DatabaseConnect();
            mysql_query("DELETE  FROM `Images` WHERE `imageID`=" . $TicketId . "");
            $dbConnect->close();
            // if everything is ok, try to upload file
        } else {
            if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) {
                $respond = array('success' => true, 'id' => $TicketId);
                createthumb($target_file, $FileName . "150x150." . $imageFileType, 150, 150);
                $dbConnect = new DatabaseConnect();
                mysql_query("UPDATE `" . DB_DATABASE . "`.`Images` SET `imageSrc` = '" . $FileNameOnline . "', `ext` = '" . $imageFileType . "' WHERE `Images`.`imageID` = " . $TicketId . "");
                echo json_encode($respond);
                //SUCESS uploading
            } else {
                $respond = array('success' => false);
                echo json_encode($respond);
                $dbConnect = new DatabaseConnect();
                mysql_query("DELETE  FROM `Images` WHERE `imageID`=" . $TicketId . "");
                $dbConnect->close();
            }
        }
    }
}
function createthumb($name, $filename, $new_w, $new_h)
    function getStamp($params)
    {
        // iCthumb generator pre-settings
        include_once JPATH_ROOT . '/media/com_icagenda/scripts/icthumb.php';
        $iC_params = JComponentHelper::getParams('com_icagenda');
        // Check if GD is enabled on the server
        if (extension_loaded('gd') && function_exists('gd_info')) {
            $thumb_generator = $iC_params->get('thumb_generator', 1);
        } else {
            $thumb_generator = 0;
        }
        $timeformat = '1';
        $timeformat = $iC_params->get('timeformat', 1);
        if ($timeformat == 1) {
            $lang_time = 'H:i';
        } else {
            $lang_time = 'h:i A';
        }
        // Check if fopen is allowed
        $fopen = true;
        $result = ini_get('allow_url_fopen');
        if (empty($result)) {
            $fopen = false;
        }
        $this->start($params);
        // Get the database
        $db = JFactory::getDbo();
        $query = $db->getQuery(true);
        // Build the query
        $query->select('e.*,
				e.place as place_name,
				c.title as cat_title,
				c.alias as cat_alias,
				c.color as cat_color,
				c.ordering as cat_order
			')->from($db->qn('#__icagenda_events') . ' AS e')->leftJoin($db->qn('#__icagenda_category') . ' AS c ON ' . $db->qn('c.id') . ' = ' . $db->qn('e.catid'));
        // Where State is 'published'
        $where = $db->qn('e.state') . ' = ' . $db->q('1');
        // Where event is 'approved'
        $where .= ' AND ' . $db->qn('e.approval') . ' = ' . $db->q('0');
        // Add filters
        if (isset($this->filter)) {
            foreach ($this->filter as $filter) {
                $where .= $filter;
            }
        }
        // Check Access Levels
        $user = JFactory::getUser();
        $userID = $user->id;
        $userLevels = $user->getAuthorisedViewLevels();
        if (version_compare(JVERSION, '3.0', 'lt')) {
            $userGroups = $user->getAuthorisedGroups();
        } else {
            $userGroups = $user->groups;
        }
        //		$user = JFactory::getUser();
        //		$userLevels = $user->getAuthorisedViewLevels();
        $userAccess = implode(', ', $userLevels);
        if (!in_array('8', $userGroups)) {
            $where .= ' AND ' . $db->qn('e.access') . ' IN (' . $userAccess . ')';
        }
        // Where
        $query->where($where);
        //		$query.=' LIMIT 0, 1000';
        // Run the query
        $db->setQuery($query);
        // Invoke the query
        $res = $db->loadObjectList();
        $days = $this->getDays($this->date_start, 'Y-m-d H:i');
        foreach ($res as $r) {
            // liste dates calendrier
            if (isset($next)) {
                $next = $next;
            } else {
                $next = '';
            }
            $datemultiplelist = $this->getDatelist($r->dates, $next);
            $datelist = $datemultiplelist;
            $AllDates = array();
            if (isset($r->weekdays)) {
                $weekdays = $r->weekdays;
            } else {
                $weekdays = '';
            }
            $weekdays = explode(',', $weekdays);
            $weekdaysarray = array();
            foreach ($weekdays as $wed) {
                array_push($weekdaysarray, $wed);
            }
            if (in_array('', $weekdaysarray)) {
                $arrayWeekDays = array(0, 1, 2, 3, 4, 5, 6);
            } elseif ($r->weekdays) {
                $arrayWeekDays = $weekdaysarray;
            } elseif (in_array('0', $weekdaysarray)) {
                $arrayWeekDays = $weekdaysarray;
            } else {
                $arrayWeekDays = array(0, 1, 2, 3, 4, 5, 6);
            }
            $WeeksDays = $arrayWeekDays;
            // If Single Dates, added to all dates for this event
            $singledates = unserialize($r->dates);
            if (isset($datemultiplelist) and $datemultiplelist != NULL and !in_array('0000-00-00 00:00:00', $singledates)) {
                $AllDates = array_merge($AllDates, $datemultiplelist);
            }
            $StDate = date('Y-m-d H:i', $this->mkttime($r->startdate));
            $EnDate = date('Y-m-d H:i', $this->mkttime($r->enddate));
            $perioddates = $this->getDatesPeriod($StDate, $EnDate);
            $onlyStDate = '';
            if (isset($this->onlyStDate)) {
                $onlyStDate = $this->onlyStDate;
            }
            if (isset($perioddates) and $perioddates != NULL) {
                if ($onlyStDate == 1) {
                    array_push($AllDates, $StDate);
                } else {
                    foreach ($perioddates as $Dat) {
                        if (in_array(date('w', strtotime($Dat)), $WeeksDays)) {
                            $SingleDate = date('Y-m-d H:i', $this->mkttime($Dat));
                            array_push($AllDates, $SingleDate);
                        }
                    }
                }
            }
            rsort($AllDates);
            //liste dates next
            $datemlist = $this->getmlist($r->dates, $next);
            $dateplist = $this->getplist($r->period, $next);
            if ($dateplist) {
                $datelistcal = array_merge($datemlist, $dateplist);
            } else {
                $datelistcal = $datemlist;
            }
            $todaytime = time();
            rsort($datelist);
            rsort($datelistcal);
            // requête Itemid
            $lang = JFactory::getLanguage();
            $langcur = $lang->getTag();
            $langcurrent = $langcur;
            $noidm = '';
            $db = JFactory::getDbo();
            $query = $db->getQuery(true);
            $query->select('id AS idm')->from('#__menu')->where("(link = 'index.php?option=com_icagenda&view=list') AND (published > 0) AND (language = '{$langcurrent}')");
            $db->setQuery($query);
            $idm = $db->loadResult();
            $mItemid = $idm;
            if ($mItemid == NULL) {
                $db = JFactory::getDbo();
                $query = $db->getQuery(true);
                $query->select('id AS noidm')->from('#__menu')->where("(link = 'index.php?option=com_icagenda&view=list') AND (published > 0) AND (language = '*')");
                $db->setQuery($query);
                $noidm = $db->loadResult();
                $noidm = $noidm;
            }
            $nolink = '';
            if ($noidm == NULL && $mItemid == NULL) {
                $nolink = 1;
            }
            $iCmenuitem = '';
            $iCmenuitem = $params->get('iCmenuitem');
            if (is_numeric($iCmenuitem)) {
                $lien = $iCmenuitem;
            } else {
                if ($mItemid == NULL) {
                    $lien = $noidm;
                } else {
                    $lien = $mItemid;
                }
            }
            $eventnumber = NULL;
            $eventnumber = $r->id;
            if ($nolink == 1) {
                $urlevent = '#';
            } else {
                $urlevent = JRoute::_('index.php?option=com_icagenda&amp;view=list&amp;layout=event&amp;id=' . (int) $eventnumber . '&amp;Itemid=' . (int) $lien);
            }
            // Gets Short Description limit, set in global options of the component iCagenda
            $limit = JComponentHelper::getParams('com_icagenda')->get('ShortDescLimit', '100');
            // Html tags removal Global Option (component iCagenda) - Short Description
            $Filtering_ShortDesc_Global = JComponentHelper::getParams('com_icagenda')->get('Filtering_ShortDesc_Global', '');
            $HTMLTags_ShortDesc_Global = JComponentHelper::getParams('com_icagenda')->get('HTMLTags_ShortDesc_Global', array());
            // Get Module Option
            $Filtering_ShortDesc_Local = $this->filtering_shortDesc;
            /**
             * START Filtering HTML method
             */
            $limit = is_numeric($limit) ? $limit : false;
            $descdata = $r->desc;
            $desc_full = deleteAllBetween('{', '}', $descdata);
            // Gets length of the short desc, when not filtered
            $limit_not_filtered = substr($desc_full, 0, $limit);
            $text_length = strlen($limit_not_filtered);
            // Gets length of the short desc, after html filtering
            $limit_filtered = preg_replace('/[\\p{Z}\\s]{2,}/u', ' ', $limit_not_filtered);
            $limit_filtered = strip_tags($limit_filtered);
            $text_short_length = strlen($limit_filtered);
            // Sets Limit + special tags authorized
            $limit_short = $limit + ($text_length - $text_short_length);
            // Replaces all authorized html tags with tag strings
            if (empty($Filtering_ShortDesc_Local) && $Filtering_ShortDesc_Global == '1') {
                $desc_full = str_replace('+', '@@', $desc_full);
                $desc_full = in_array('1', $HTMLTags_ShortDesc_Global) ? str_replace('<br>', '+@br@', $desc_full) : $desc_full;
                $desc_full = in_array('1', $HTMLTags_ShortDesc_Global) ? str_replace('<br/>', '+@br@', $desc_full) : $desc_full;
                $desc_full = in_array('1', $HTMLTags_ShortDesc_Global) ? str_replace('<br />', '+@br@', $desc_full) : $desc_full;
                $desc_full = in_array('2', $HTMLTags_ShortDesc_Global) ? str_replace('<b>', '+@b@', $desc_full) : $desc_full;
                $desc_full = in_array('2', $HTMLTags_ShortDesc_Global) ? str_replace('</b>', '@bc@', $desc_full) : $desc_full;
                $desc_full = in_array('3', $HTMLTags_ShortDesc_Global) ? str_replace('<strong>', '@strong@', $desc_full) : $desc_full;
                $desc_full = in_array('3', $HTMLTags_ShortDesc_Global) ? str_replace('</strong>', '@strongc@', $desc_full) : $desc_full;
                $desc_full = in_array('4', $HTMLTags_ShortDesc_Global) ? str_replace('<i>', '@i@', $desc_full) : $desc_full;
                $desc_full = in_array('4', $HTMLTags_ShortDesc_Global) ? str_replace('</i>', '@ic@', $desc_full) : $desc_full;
                $desc_full = in_array('5', $HTMLTags_ShortDesc_Global) ? str_replace('<em>', '@em@', $desc_full) : $desc_full;
                $desc_full = in_array('5', $HTMLTags_ShortDesc_Global) ? str_replace('</em>', '@emc@', $desc_full) : $desc_full;
                $desc_full = in_array('6', $HTMLTags_ShortDesc_Global) ? str_replace('<u>', '@u@', $desc_full) : $desc_full;
                $desc_full = in_array('6', $HTMLTags_ShortDesc_Global) ? str_replace('</u>', '@uc@', $desc_full) : $desc_full;
            } elseif ($Filtering_ShortDesc_Local == '2' || $Filtering_ShortDesc_Global == '' && empty($Filtering_ShortDesc_Local)) {
                $desc_full = '@i@' . $desc_full . '@ic@';
                $limit_short = $limit_short + 7;
            } else {
                $desc_full = $desc_full;
            }
            // Removes HTML tags
            $desc_nohtml = strip_tags($desc_full);
            // Replaces all sequences of two or more spaces, tabs, and/or line breaks with a single space
            $desc_nohtml = preg_replace('/[\\p{Z}\\s]{2,}/u', ' ', $desc_nohtml);
            // Replaces all spaces with a single +
            $desc_nohtml = str_replace(' ', '+', $desc_nohtml);
            if (strlen($desc_nohtml) > $limit_short) {
                // Cuts full description, to get short description
                $string_cut = substr($desc_nohtml, 0, $limit_short);
                // Detects last space of the short description
                $last_space = strrpos($string_cut, '+');
                // Cuts the short description after last space
                $string_ok = substr($string_cut, 0, $last_space);
                // Counts number of tags converted to string, and returns lenght
                $nb_br = substr_count($string_ok, '+@br@');
                $nb_plus = substr_count($string_ok, '@@');
                $nb_bopen = substr_count($string_ok, '@b@');
                $nb_bclose = substr_count($string_ok, '@bc@');
                $nb_strongopen = substr_count($string_ok, '@strong@');
                $nb_strongclose = substr_count($string_ok, '@strongc@');
                $nb_iopen = substr_count($string_ok, '@i@');
                $nb_iclose = substr_count($string_ok, '@ic@');
                $nb_emopen = substr_count($string_ok, '@em@');
                $nb_emclose = substr_count($string_ok, '@emc@');
                $nb_uopen = substr_count($string_ok, '@u@');
                $nb_uclose = substr_count($string_ok, '@uc@');
                // Replaces tag strings with html tags
                $string_ok = str_replace('@br@', '<br />', $string_ok);
                $string_ok = str_replace('@b@', '<b>', $string_ok);
                $string_ok = str_replace('@bc@', '</b>', $string_ok);
                $string_ok = str_replace('@strong@', '<strong>', $string_ok);
                $string_ok = str_replace('@strongc@', '</strong>', $string_ok);
                $string_ok = str_replace('@i@', '<i>', $string_ok);
                $string_ok = str_replace('@ic@', '</i>', $string_ok);
                $string_ok = str_replace('@em@', '<em>', $string_ok);
                $string_ok = str_replace('@emc@', '</em>', $string_ok);
                $string_ok = str_replace('@u@', '<u>', $string_ok);
                $string_ok = str_replace('@uc@', '</u>', $string_ok);
                $string_ok = str_replace('+', ' ', $string_ok);
                $string_ok = str_replace('@@', '+', $string_ok);
                $text = $string_ok;
                // Close html tags if not closed
                if ($nb_bclose < $nb_bopen) {
                    $text = $string_ok . '</b>';
                }
                if ($nb_strongclose < $nb_strongopen) {
                    $text = $string_ok . '</strong>';
                }
                if ($nb_iclose < $nb_iopen) {
                    $text = $string_ok . '</i>';
                }
                if ($nb_emclose < $nb_emopen) {
                    $text = $string_ok . '</em>';
                }
                if ($nb_uclose < $nb_uopen) {
                    $text = $string_ok . '</u>';
                }
                $ic_readmore = '[&#46;&#46;&#46;]';
                $return_text = $text . ' ' . $ic_readmore;
                $descShort = $limit ? $return_text : '';
            } else {
                $desc_full = $desc_nohtml;
                $desc_full = str_replace('@br@', '<br />', $desc_full);
                $desc_full = str_replace('@b@', '<b>', $desc_full);
                $desc_full = str_replace('@bc@', '</b>', $desc_full);
                $desc_full = str_replace('@strong@', '<strong>', $desc_full);
                $desc_full = str_replace('@strongc@', '</strong>', $desc_full);
                $desc_full = str_replace('@i@', '<i>', $desc_full);
                $desc_full = str_replace('@ic@', '</i>', $desc_full);
                $desc_full = str_replace('@em@', '<em>', $desc_full);
                $desc_full = str_replace('@emc@', '</em>', $desc_full);
                $desc_full = str_replace('@u@', '<u>', $desc_full);
                $desc_full = str_replace('@uc@', '</u>', $desc_full);
                $desc_full = str_replace('+', ' ', $desc_full);
                $desc_full = str_replace('@@', '+', $desc_full);
                $descShort = $limit ? $desc_full : '';
            }
            /** END Filtering HTML function */
            /**
             * To be moved to a special library
             */
            // START iCthumb
            // Initialize Vars
            $Image_Link = '';
            $Thumb_Link = '';
            $Display_Thumb = false;
            $No_Thumb_Option = false;
            $Default_Thumb = false;
            $MimeTypeOK = true;
            $MimeTypeERROR = false;
            $Invalid_Link = false;
            $Invalid_Img_Format = false;
            $fopen_bmp_error_msg = false;
            // SETTINGS ICTHUMB
            $FixedImageVar = $r->image;
            // Set if run iCthumb
            if ($FixedImageVar and $thumb_generator == 1) {
                $params_media = JComponentHelper::getParams('com_media');
                $image_path = $params_media->get('image_path', 'images');
                // Set folder vars
                $fld_icagenda = 'icagenda';
                $fld_thumbs = 'thumbs';
                $fld_copy = 'copy';
                // SETTINGS ICTHUMB
                $thumb_width = '100';
                $thumb_height = '200';
                $thumb_quality = '100';
                $thumb_destination = 'themes/w' . $thumb_width . 'h' . $thumb_height . 'q' . $thumb_quality . '_';
                // Get Image File Infos
                $url = $FixedImageVar;
                $decomposition = explode('/', $url);
                // in each parent
                $i = 0;
                while (isset($decomposition[$i])) {
                    $i++;
                }
                $i--;
                $imgname = $decomposition[$i];
                $fichier = explode('.', $decomposition[$i]);
                $imgtitle = $fichier[0];
                $imgextension = strtolower($fichier[1]);
                // fixed 3.1.10
                // Clean file name
                jimport('joomla.filter.output');
                $cleanFileName = JFilterOutput::stringURLSafe($imgtitle) . '.' . $imgextension;
                $cleanTitle = JFilterOutput::stringURLSafe($imgtitle);
                //							$cleanFileName2 = cleanString($imgtitle) . '.' . $imgextension;
                //							$cleanTitle2 = cleanString($imgtitle);
                // Paths to thumbs and copy folders
                $thumbsPath = $image_path . '/' . $fld_icagenda . '/' . $fld_thumbs . '/';
                $copyPath = $image_path . '/' . $fld_icagenda . '/' . $fld_thumbs . '/' . $fld_copy . '/';
                // Image pre-settings
                $imageValue = $FixedImageVar;
                $Image_Link = $FixedImageVar;
                $Invalid_LinkMsg = '<i class="icon-warning"></i><br /><span style="color:red;"><strong>' . JText::_('COM_ICAGENDA_INVALID_PICTURE_LINK') . '</strong></span>';
                $Wrong_img_format = '<i class="icon-warning"></i><br/><span style="color:red;"><strong>' . JText::_('COM_ICAGENDA_NOT_AUTHORIZED_IMAGE_TYPE') . '</strong><br/>' . JText::_('COM_ICAGENDA_NOT_AUTHORIZED_IMAGE_TYPE_INFO') . '</span>';
                $fopen_bmp_error = '<i class="icon-warning"></i><br/><span style="color:red;"><strong>' . JText::_('COM_ICAGENDA_PHP_ERROR_FOPEN_COPY_BMP') . '</strong><br/>' . JText::_('COM_ICAGENDA_PHP_ERROR_FOPEN_COPY_BMP_INFO') . '</span>';
                // Mime-Type pre-settings
                $errorMimeTypeMsg = '<i class="icon-warning"></i><br /><span style="color:red;"><strong>' . JText::_('COM_ICAGENDA_ERROR_MIME_TYPE') . '</strong><br/>' . JText::_('COM_ICAGENDA_ERROR_MIME_TYPE_NO_THUMBNAIL');
                // url to thumbnails already created
                $Thumb_Link = $image_path . '/' . $fld_icagenda . '/' . $fld_thumbs . '/' . $thumb_destination . $cleanFileName;
                $Thumb_aftercopy_Link = $image_path . '/' . $fld_icagenda . '/' . $fld_thumbs . '/' . $thumb_destination . $cleanTitle . '.jpg';
                // Check if thumbnails already created
                if (file_exists(JPATH_ROOT . '/' . $Thumb_Link) and !file_exists(JPATH_ROOT . '/' . $Thumb_aftercopy_Link)) {
                    $Thumb_Link = $Thumb_Link;
                    $Display_Thumb = true;
                } elseif (file_exists(JPATH_ROOT . '/' . $Thumb_aftercopy_Link)) {
                    $Thumb_Link = $Thumb_aftercopy_Link;
                    $Display_Thumb = true;
                } else {
                    if (filter_var($imageValue, FILTER_VALIDATE_URL)) {
                        $linkToImage = $imageValue;
                    } else {
                        $linkToImage = JPATH_ROOT . '/' . $imageValue;
                    }
                    if (file_exists($linkToImage)) {
                        // Test Mime-Type
                        $fileinfos = getimagesize($linkToImage);
                        $mimeType = $fileinfos['mime'];
                        $extensionType = 'image/' . $imgextension;
                        // Message Error Mime-Type info
                        $errorMimeTypeInfo = '<span style="color:black;"><br/>' . JText::sprintf('COM_ICAGENDA_ERROR_MIME_TYPE_INFO', $imgextension, $mimeType);
                        // Error message if Mime-Type is not the same as extension
                        if ($imgextension == 'jpeg' or $imgextension == 'jpg') {
                            if ($mimeType != 'image/jpeg' and $mimeType != 'image/jpg') {
                                $MimeTypeOK = false;
                                $MimeTypeERROR = true;
                            }
                        } elseif ($imgextension == 'bmp') {
                            if ($mimeType != 'image/bmp' and $mimeType != 'image/x-ms-bmp') {
                                $MimeTypeOK = false;
                                $MimeTypeERROR = true;
                            }
                        } else {
                            if ($mimeType != $extensionType) {
                                $MimeTypeOK = false;
                                $MimeTypeERROR = true;
                            }
                        }
                    }
                    // If Error mime-type, no thumbnail creation
                    if ($MimeTypeOK) {
                        // Call function and create image thumbnail for events list in admin
                        // If Image JPG, JPEG, PNG or GIF
                        if ($imgextension == "jpg" or $imgextension == "jpeg" or $imgextension == "png" or $imgextension == "gif") {
                            $Thumb_Link = $Thumb_Link;
                            if (!file_exists(JPATH_ROOT . '/' . $Thumb_Link)) {
                                if (filter_var($imageValue, FILTER_VALIDATE_URL)) {
                                    if (url_exists($imageValue) and $fopen) {
                                        $testFile = JPATH_ROOT . '/' . $copyPath . $cleanFileName;
                                        if (!file_exists($testFile)) {
                                            //Get the file
                                            $content = file_get_contents($imageValue);
                                            //Store in the filesystem.
                                            $fp = fopen(JPATH_ROOT . '/' . $copyPath . $cleanFileName, "w");
                                            fwrite($fp, $content);
                                            fclose($fp);
                                        }
                                        $linkToImage = JPATH_ROOT . '/' . $copyPath . $cleanFileName;
                                        $imageValue = $copyPath . $cleanFileName;
                                    } else {
                                        $linkToImage = $imageValue;
                                    }
                                } else {
                                    $linkToImage = JPATH_ROOT . '/' . $imageValue;
                                }
                                if (url_exists($linkToImage) or file_exists($linkToImage)) {
                                    createthumb($linkToImage, JPATH_ROOT . '/' . $Thumb_Link, $thumb_width, $thumb_height, $thumb_quality);
                                } else {
                                    $Invalid_Link = true;
                                }
                            }
                        } elseif ($imgextension == "bmp") {
                            $Image_Link = $copyPath . $cleanTitle . '.jpg';
                            $Thumb_Link = $Thumb_aftercopy_Link;
                            if (!file_exists(JPATH_ROOT . '/' . $Thumb_Link)) {
                                if (filter_var($imageValue, FILTER_VALIDATE_URL)) {
                                    if (url_exists($imageValue) and $fopen) {
                                        $testFile = JPATH_ROOT . '/' . $copyPath . $cleanTitle . '.jpg';
                                        if (!file_exists($testFile)) {
                                            //Get the file
                                            $content = file_get_contents($imageValue);
                                            //Store in the filesystem.
                                            $fp = fopen(JPATH_ROOT . '/' . $copyPath . $cleanFileName, "w");
                                            fwrite($fp, $content);
                                            fclose($fp);
                                            $imageNewValue = JPATH_ROOT . '/' . $copyPath . $cleanFileName;
                                            imagejpeg(icImageCreateFromBMP($imageNewValue), JPATH_ROOT . '/' . $copyPath . $cleanTitle . '.jpg', 100);
                                            unlink($imageNewValue);
                                        }
                                    } else {
                                        $linkToImage = $imageValue;
                                    }
                                } else {
                                    imagejpeg(icImageCreateFromBMP(JPATH_ROOT . '/' . $imageValue), JPATH_ROOT . '/' . $copyPath . $cleanTitle . '.jpg', 100);
                                }
                                $imageValue = $copyPath . $cleanTitle . '.jpg';
                                $linkToImage = JPATH_ROOT . '/' . $imageValue;
                                if (!$fopen) {
                                    $fopen_bmp_error_msg = true;
                                } elseif (url_exists($linkToImage) or file_exists($linkToImage)) {
                                    createthumb($linkToImage, JPATH_ROOT . '/' . $Thumb_Link, $thumb_width, $thumb_height, $thumb_quality);
                                } else {
                                    $Invalid_Link = true;
                                }
                            }
                        } else {
                            if (url_exists($linkToImage) or file_exists($linkToImage)) {
                                $Invalid_Img_Format = true;
                            } else {
                                $Invalid_Link = true;
                            }
                        }
                        if (!$Invalid_Link) {
                            $Display_Thumb = true;
                        }
                    } else {
                        if ($imgextension == "jpg" or $imgextension == "jpeg" or $imgextension == "png" or $imgextension == "gif" or $imgextension == "bmp") {
                            $MimeTypeERROR = true;
                        } else {
                            $Invalid_Img_Format = true;
                            $MimeTypeERROR = false;
                        }
                    }
                }
            } elseif ($FixedImageVar and $thumb_generator == 0) {
                $No_Thumb_Option = true;
            } else {
                $Default_Thumb = true;
            }
            // END iCthumb
            // Set Thumbnail
            $default_thumbnail = 'media/com_icagenda/images/nophoto.jpg';
            if ($Invalid_Img_Format) {
                $thumb_img = $default_thumbnail;
            }
            if ($Invalid_Link) {
                $thumb_img = $default_thumbnail;
            }
            if ($MimeTypeERROR) {
                $thumb_img = $default_thumbnail;
            }
            if ($fopen_bmp_error_msg) {
                $thumb_img = $default_thumbnail;
            }
            if ($Display_Thumb) {
                $thumb_img = $Thumb_Link;
            }
            if ($No_Thumb_Option) {
                $thumb_img = $FixedImageVar;
            }
            if ($Default_Thumb) {
                if ($r->image) {
                    $thumb_img = $default_thumbnail;
                } else {
                    $thumb_img = '';
                }
            }
            if (!file_exists(JPATH_ROOT . '/' . $Thumb_Link) and $r->image) {
                $thumb_img = $default_thumbnail;
            }
            $evtParams = '';
            $evtParams = new JRegistry($r->params);
            // Display Time
            $dp_time = $params->get('dp_time', 1);
            if ($dp_time == 1) {
                $r_time = true;
            } else {
                $r_time = false;
            }
            // Display City
            $dp_city = $params->get('dp_city', 1);
            if ($dp_city == 1) {
                $r_city = $r->city;
            } else {
                $r_city = false;
            }
            // Display Country
            $dp_country = $params->get('dp_country', 1);
            if ($dp_country == 1) {
                $r_country = $r->country;
            } else {
                $r_country = false;
            }
            // Display Venue Name
            $dp_venuename = $params->get('dp_venuename', 1);
            if ($dp_venuename == 1) {
                $r_place = $r->place_name;
            } else {
                $r_place = false;
            }
            // Display Short Description
            $dp_shortDesc = $params->get('dp_shortDesc', '');
            if (!$dp_shortDesc) {
                $descShort = false;
            } elseif ($dp_shortDesc == 2) {
                $descShort = $r->metadesc;
            }
            // Display Registration Infos
            $dp_regInfos = $params->get('dp_regInfos', 1);
            if ($dp_regInfos == 1) {
                $registered = $this->registered($r->id);
                $maxTickets = $evtParams->get('maxReg');
                $TicketsLeft = $maxTickets - $registered;
            } else {
                $registered = false;
                $maxTickets = false;
                $TicketsLeft = false;
            }
            $event = array('id' => (int) $r->id, 'registered' => (int) $registered, 'maxTickets' => (int) $maxTickets, 'TicketsLeft' => (int) $TicketsLeft, 'Itemid' => (int) $mItemid, 'url' => $urlevent, 'title' => $r->title, 'next' => $this->formatDate($r->next), 'image' => $thumb_img, 'address' => $r->address, 'city' => $r_city, 'country' => $r_country, 'place' => $r_place, 'description' => $r->desc, 'descShort' => $descShort, 'cat_title' => $r->cat_title, 'cat_order' => $r->cat_order, 'cat_color' => $r->cat_color, 'nb_events' => count($r->id), 'no_image' => JTEXT::_('MOD_ICCALENDAR_NO_IMAGE'), 'params' => $r->params);
            // Initialize
            $access = '0';
            $control = '';
            // Access Control
            $user = JFactory::getUser();
            $userLevels = $user->getAuthorisedViewLevels();
            $access = $r->access;
            if ($access == '0') {
                $access = '1';
            }
            if (in_array($access, $userLevels) or in_array('8', $userGroups)) {
                $control = $access;
            }
            // Language Control
            $lang = JFactory::getLanguage();
            $eventLang = '';
            $langTag = '';
            $langTag = $lang->getTag();
            if (isset($r->language)) {
                $eventLang = $r->language;
            }
            if ($eventLang == '') {
                $eventLang = $langTag;
            }
            if ($eventLang == '*') {
                $eventLang = $langTag;
            }
            $events_per_day = array();
            $displaytime = '';
            if (isset($r->displaytime)) {
                $displaytime = $r->displaytime;
            }
            // Get List of Dates
            if ($control == $access) {
                if ($eventLang == $langTag) {
                    if (is_numeric($lien) && is_numeric($eventnumber) && !is_array($lien) && !is_array($eventnumber)) {
                        if (is_array($event)) {
                            foreach ($AllDates as $d) {
                                if ($r_time) {
                                    $time = array('time' => date($lang_time, $this->mkttime($d)), 'displaytime' => $displaytime);
                                } else {
                                    $time = array('time' => '', 'displaytime' => '');
                                }
                                $event = array_merge($event, $time);
                                foreach ($days as $k => $dy) {
                                    if (date('Y-m-d', strtotime($d)) == date('Y-m-d', strtotime($dy['date']))) {
                                        array_push($days[$k]['events'], $event);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        $i = '';
        $lang = JFactory::getLanguage();
        $langcur = $lang->getTag();
        $langcurrent = $langcur;
        $db = JFactory::getDbo();
        $query = $db->getQuery(true);
        $query->select('id AS idm')->from('#__menu')->where("(link = 'index.php?option=com_icagenda&view=list') AND (published > 0) AND (language = '{$langcurrent}')");
        $db->setQuery($query);
        $idm = $db->loadResult();
        $mItemid = $idm;
        if ($mItemid == NULL) {
            $db = JFactory::getDbo();
            $query = $db->getQuery(true);
            $query->select('id AS noidm')->from('#__menu')->where("(link = 'index.php?option=com_icagenda&view=list') AND (published > 0) AND (language = '*')");
            $db->setQuery($query);
            $noidm = $db->loadResult();
            $noidm = $noidm;
        }
        $nolink = '';
        if ($noidm == NULL && $mItemid == NULL) {
            $nolink = 1;
        }
        if ($nolink == 1) {
            do {
                echo '<div style="color:#a40505; text-align: center;"><b>info :</b></div><div style="color:#a40505; font-size: 0.8em; text-align: center;">' . JText::_('MOD_ICCALENDAR_COM_ICAGENDA_MENULINK_UNPUBLISHED_MESSAGE') . '</div>';
            } while ($i > 0);
        }
        $db = JFactory::getDbo();
        $query = $db->getQuery(true);
        $query->select('id AS nbevt')->from('`#__icagenda_events` AS e')->where('e.state > 0');
        $db->setQuery($query);
        $nbevt = $db->loadResult();
        $nbevt = count($nbevt);
        if ($nbevt == NULL) {
            //			do {
            echo '<div style="font-size: 0.8em; text-align: center;">' . JText::_('MOD_ICCALENDAR_NO_EVENT') . '</div>';
            //			} while ($i = 0);
        }
        return $days;
    }
예제 #20
0
파일: index.php 프로젝트: QOAL/webscripts
            $desc .= trim($info) . "<br />";
        }
    }
    echo '		<p style="text-align: center;"><a href="index.php"><img class="fullview" src="' . $IMAGE_FOLDER . $IMG . '" alt="' . $IMG . '" title="' . $IMG . ' | Last modified on ' . date("F d Y H:i:s.", filemtime($IMAGE_FOLDER . $IMG)) . '"/></a><br /><b>' . $IMG . '</b>' . $desc . '</p>' . "\n";
} else {
    //Show the main gallery view
    if (file_exists($THUMBS_FOLDER) == False) {
        mkdir($THUMBS_FOLDER);
    }
    $pics = directory($IMAGE_FOLDER, "jpg,jpeg,png,gif");
    if ($pics[0] != "") {
        $output = '';
        foreach ($pics as $p) {
            //Don't make the thumbnails again!!
            if (file_exists($THUMBS_FOLDER . "tn_" . $p . '.' . $THUMB_FORMAT) == false) {
                createthumb($IMAGE_FOLDER . $p, $THUMBS_FOLDER . "tn_" . $p . '.' . $THUMB_FORMAT, $thumbw, $thumbh);
            }
            $output .= '			<div class="frame"><div class="imgcont"><div class="img"><p class="img"><a href="index.php?img=' . $p . '"><img src="' . $THUMBS_FOLDER . 'tn_' . $p . '.' . $THUMB_FORMAT . '" alt="' . $p . '" title="' . $p . ' | Last modified on ' . date("F d Y H:i:s.", filemtime($IMAGE_FOLDER . $p)) . '"/></a></p></div></div><div class="caption"><a href="index.php?img=' . $p . '"><b>' . $p . '</b></a></div></div>' . "\n";
        }
        echo '		<table border="0" width="100%" cellspacing="0" align="center"><tr><td>' . "\n";
        echo $output;
        echo '		</td></tr></table>' . "\n";
    } else {
        echo '			No images to display<br/>This makes me sad :(' . "\n";
    }
    //kill unused thumbs
    $thumbs = directory($THUMBS_FOLDER, "jpg,jpeg,png,gif");
    foreach ($thumbs as $t) {
        $tp = substr($t, 3, -4);
        if (!in_array($tp, $pics)) {
            unlink($THUMBS_FOLDER . $t);
예제 #21
0
function displayImage($imagefolder, $imagefilename, $thumbsfolder, $maxsize, $linktooriginal)
{
    $originalfile = $imagefolder . "/" . $imagefilename;
    $thumbnailfile = $thumbsfolder . "/tn_" . $maxsize . "_" . $imagefilename;
    if (!file_exists($thumbnailfile)) {
        createthumb($originalfile, $thumbnailfile, $maxsize, $maxsize);
    }
    echo "<td><a href='";
    if (!$linktooriginal) {
        echo currentURL() . "/" . $_SERVER['GALLERY_ROOT'] . "view_image.php?album=" . $_GET['album'] . "&image=" . $imagefilename;
    } else {
        echo $originalfile;
    }
    echo "'><img src='" . $thumbnailfile . "'/></a></td>";
}
예제 #22
0
        }
        if ($formatfile == "PNG") {
            imagepng($dst_img, $filename);
        }
        if ($formatfile == "BMP") {
            imagewbmp($dst_img, $filename);
        }
        if ($formatfile == "GIF") {
            imagegif($dst_img, $filename);
        }
        if ($formatfile == "JPG") {
            imagejpeg($dst_img, $filename);
        }
        imagedestroy($dst_img);
        if ($formatfile != "BMP") {
            imagedestroy($src_img);
        }
    }
    createthumb($urlimage, $urlthumb, $tsize, $tsize, $formatfile);
    if ($formatfile != "BMP") {
        echo '<a href="' . $urlimage . '" target="_blank"><img src="' . $urlthumb . '"><br></a><br>';
    } else {
        echo '<a href="' . $urlimage . '" target="_blank"><img src="' . $urlthumb . '"><br></a><br>';
        echo '<b>The BMP images will not have thumbnail !</b>';
    }
}
?>
<body>
<A href="index.php">Ke Belakang</A>
</body>
</html>