Ejemplo n.º 1
0
			if(ini_get("memory_limit")){
				$memory_limit = ini_get("memory_limit");
			} else {
				$memory_limit = 256;
			}
			
			// FIND THE FILES THAT ARE LEFT IN THE FTP FOLDER
			if ($handle = opendir($ftp_path)){
				$count_check = 0;
				while (false !== ($file = readdir($handle))){
					if(is_file("../ftp/" . $file)){
						$count_check++;
						$imgtype = getimagesize("../ftp/" . $file);
						
						if($imgtype[2] == 2){
							$mfs = figure_memory_needed("../ftp/" . $file);
							if($mfs < $memory_limit){
								$img_files[]  = $file;
							}
							//echo $file . "<br>";
						} else {
							//echo $file  . " is not a supported image file<br>";
						}
					}
				}
				if($count_check > 1){
					natcasesort($img_files);
				}
				closedir($handle);
			}
			
Ejemplo n.º 2
0
  * Do a little error checking to make sure that the file exists and that the server can process it
  */
 //echo $path; exit; // Testing
 if (!file_exists($path) or is_dir($path) == true) {
     $path = BASE_PATH . "/assets/images/blank.png";
     // File doesn't exist or a folder was returned - use blank.png
     $config['cacheImages'] = 0;
     // Override caching
 } else {
     if ($offSiteRequest == true) {
         $path = BASE_PATH . "/assets/images/link.png";
         // External linking detected - use link.png
         $config['cacheImages'] = 0;
         // Override caching
     } else {
         if (figure_memory_needed($path) > getMemoryLimit()) {
             $path = BASE_PATH . "/assets/images/error.png";
             // Not enough memory - use error.png
             $config['cacheImages'] = 0;
             // Override caching
         }
     }
 }
 /* // Testing
 		echo 'path: '.$path.'<br>';
 		echo 'quality: '.$quality.'<br>';
 		echo 'crop: '.$crop.'<br>';
 		echo 'hcrop: '.$hcrop.'<br>';
 		echo 'sharpen: '.$sharpen.'<br>';
 		echo 'watermark: '.$watermark.'<br>';
 		exit;
Ejemplo n.º 3
0
     }
 }
 // Check if file has been uploaded
 if (!$chunks || $chunk == $chunks - 1) {
     // Strip the temp .part suffix off
     rename("{$filePath}.part", $filePath);
     $fileNameParts = explode(".", $fileName);
     $creatableFiletypes = getCreatableFormats();
     $iconImage = $targetDir . "icon_" . basefilename($fileName) . ".jpg";
     $thumbImage = $targetDir . "thumb_" . basefilename($fileName) . ".jpg";
     $sampleImage = $targetDir . "sample_" . basefilename($fileName) . ".jpg";
     $filenameExt = strtolower(array_pop($fileNameParts));
     # CALCULATE THE MEMORY NEEDED ONLY IF IT IS A CREATABLE FORMAT
     if (in_array(strtolower($filenameExt), $creatableFiletypes)) {
         # FIGURE MEMORY NEEDED
         $mem_needed = figure_memory_needed($targetDir . $fileName);
         if (ini_get("memory_limit")) {
             $memory_limit = ini_get("memory_limit");
         } else {
             $memory_limit = $config['DefaultMemory'];
         }
         # IF IMAGEMAGICK ALLOW TWEAKED MEMORY LIMIT
         if (class_exists('Imagick') and $config['settings']['imageproc'] == 2) {
             $memory_limit = $config['DefaultMemory'];
         }
         $autoCreateAvailable = 1;
     }
     //test($filenameExt);
     # CHECK TO SEE IF ONE CAN BE CREATED
     if (in_array(strtolower($filenameExt), $creatableFiletypes)) {
         # CHECK THE MEMORY NEEDED TO CREATE IT
Ejemplo n.º 4
0
 // Original filename
 $clean_filename = $mediaInfo['filename'];
 $filename = explode(".",$clean_filename);
 $filename_ext = strtolower(array_pop($filename));				
 $filename_glued = implode(".",$filename);
 */
 $_SESSION['testing']['filename'] = $mediaInfo['filename'];
 $temp_file_path = realpath("./assets/tmp/") . "/" . $temp_filename;
 // Move the uploaded file so we can work with it
 move_uploaded_file($_FILES['Filedata']['tmp_name'], $temp_file_path);
 # IF GD OR IMAGEMAGIK
 $creatable_filetypes = getCreatableFormats();
 # CALCULATE THE MEMORY NEEDED ONLY IF IT IS A CREATABLE FORMAT
 if (@in_array(strtolower($temp_filename_ext), $creatable_filetypes)) {
     # FIGURE MEMORY NEEDED
     $mem_needed = figure_memory_needed($temp_file_path);
     if (ini_get("memory_limit")) {
         $memory_limit = ini_get("memory_limit");
     } else {
         $memory_limit = $config['DefaultMemory'];
     }
     # IF IMAGEMAGICK ALLOW TWEAKED MEMORY LIMIT
     if (class_exists('Imagick') and $config['settings']['imageproc'] == 2) {
         $memory_limit = $config['DefaultMemory'];
     }
 }
 //test($filename,'filenamePass');
 $iconImage = "{$folderPath}icons/icon_{$newFilename}";
 $iconImageName = "icon_{$newFilename}";
 $thumbImage = "{$folderPath}thumbs/thumb_{$newFilename}";
 $thumbImageName = "thumb_{$newFilename}";