Example #1
0
 }
 $is_img = false;
 $is_video = false;
 $is_audio = false;
 $show_original = false;
 $show_original_mini = false;
 $mini_src = "";
 $src_thumb = "";
 $extension_lower = fix_strtolower($file_array['extension']);
 if (in_array($extension_lower, $ext_img)) {
     $src = $base_url . $cur_dir . rawurlencode($file);
     $mini_src = $src_thumb = $thumbs_path . $subdir . $file;
     //add in thumbs folder if not exist
     if (!file_exists($src_thumb)) {
         try {
             create_img_gd($file_path, $src_thumb, 122, 91);
             new_thumbnails_creation($current_path . $rfm_subfolder . $subdir, $file_path, $file, $current_path, $relative_image_creation, $relative_path_from_current_pos, $relative_image_creation_name_to_prepend, $relative_image_creation_name_to_append, $relative_image_creation_width, $relative_image_creation_height, $relative_image_creation_option, $fixed_image_creation, $fixed_path_from_filemanager, $fixed_image_creation_name_to_prepend, $fixed_image_creation_to_append, $fixed_image_creation_width, $fixed_image_creation_height, $fixed_image_creation_option);
         } catch (Exception $e) {
             $src_thumb = $mini_src = "";
         }
     }
     $is_img = true;
     //check if is smaller than thumb
     list($img_width, $img_height, $img_type, $attr) = getimagesize($file_path);
     if ($img_width < 122 && $img_height < 91) {
         $src_thumb = $current_path . $rfm_subfolder . $subdir . $file;
         $show_original = true;
     }
     if ($img_width < 45 && $img_height < 38) {
         $mini_src = $current_path . $rfm_subfolder . $subdir . $file;
         $show_original_mini = true;
Example #2
0
     }
 }
 foreach ($files as $nu => $file) {
     if ($file != '.' && $file != '..' && !is_dir($root . $cur_dir . $file)) {
         $is_img = false;
         $is_video = false;
         $show_original = false;
         $file_ext = substr(strrchr($file, '.'), 1);
         if (in_array($file_ext, $ext)) {
             if (in_array($file_ext, $ext_img)) {
                 $src = $base_url . $cur_dir . $file;
                 $src_thumb = $thumbs_path . $subdir . $file;
                 //add in thumbs folder if not exist
                 $thumb_path = dirname(__FILE__) . DIRECTORY_SEPARATOR . "thumbs" . DIRECTORY_SEPARATOR . $subfolder . DIRECTORY_SEPARATOR . $subdir . $file;
                 if (!file_exists($thumb_path)) {
                     create_img_gd(dirname(__FILE__) . DIRECTORY_SEPARATOR . $current_path . $subfolder . DIRECTORY_SEPARATOR . $subdir . $file, $thumb_path, 122, 91);
                 }
                 $is_img = true;
                 //check if is smaller tha thumb
                 $info = getimagesize(dirname(__FILE__) . DIRECTORY_SEPARATOR . $current_path . $subfolder . DIRECTORY_SEPARATOR . $subdir . $file);
                 if ($info[0] < 122 && $info[2] < 91) {
                     $src_thumb = $current_path . $subfolder . DIRECTORY_SEPARATOR . $subdir . $file;
                     $show_original = true;
                 }
             } elseif (file_exists('ico/' . strtoupper($file_ext) . ".png")) {
                 $src = $src_thumb = 'ico/' . strtoupper($file_ext) . ".png";
             } else {
                 $src = $src_thumb = "ico/Default.png";
             }
             if (in_array($file_ext, $ext_video)) {
                 $class_ext = 4;
                        create_img_gd($targetFile, $targetFile, $image_resizing_width, $image_resizing_height);
                    }
                    //max resizing limit control
                    $resize = false;
                    if ($image_max_width != 0 && $srcWidth > $image_max_width) {
                        $resize = true;
                        $srcHeight = $image_max_width * $srcHeight / $srcWidth;
                        $srcWidth = $image_max_width;
                    }
                    if ($image_max_height != 0 && $srcHeight > $image_max_height) {
                        $resize = true;
                        $srcWidth = $image_max_height * $srcWidth / $srcHeight;
                        $srcHeight = $image_max_height;
                    }
                    if ($resize) {
                        create_img_gd($targetFile, $targetFile, $srcWidth, $srcHeight);
                    }
                }
            }
            if ($memory_error) {
                //error
                unlink($targetFile);
                header('HTTP/1.1 406 Not enought Memory', true, 406);
                exit;
            }
        }
    } else {
        header('HTTP/1.1 406 file not permitted', true, 406);
        exit;
    }
} else {
Example #4
0
     }
     $image_data = get_file_by_url($_POST['url']);
     if ($image_data === false) {
         die('file could not be loaded');
     }
     $put_contents_path = $current_path;
     if (isset($_POST['path'])) {
         $put_contents_path .= str_replace("", "", $_POST['path']);
     }
     if (isset($_POST['name'])) {
         $put_contents_path .= str_replace("", "", $_POST['name']);
     }
     file_put_contents($put_contents_path, $image_data);
     //new thumb creation
     //try{
     create_img_gd($current_path . $_POST['path'] . $_POST['name'], $thumbs_base_path . $_POST['path'] . $_POST['name'], 122, 91);
     new_thumbnails_creation($current_path . $_POST['path'], $current_path . $_POST['path'] . $_POST['name'], $_POST['name'], $current_path, $relative_image_creation, $relative_path_from_current_pos, $relative_image_creation_name_to_prepend, $relative_image_creation_name_to_append, $relative_image_creation_width, $relative_image_creation_height, $fixed_image_creation, $fixed_path_from_filemanager, $fixed_image_creation_name_to_prepend, $fixed_image_creation_to_append, $fixed_image_creation_width, $fixed_image_creation_height);
     /*} catch (Exception $e) {
       $src_thumb=$mini_src="";
       }*/
     break;
 case 'extract':
     if (strpos($_POST['path'], '/') === 0 || strpos($_POST['path'], '../') !== false || strpos($_POST['path'], './') === 0) {
         die('wrong path');
     }
     $path = $current_path . $_POST['path'];
     $info = pathinfo($path);
     $base_folder = $current_path . fix_dirname($_POST['path']) . '/';
     switch ($info['extension']) {
         case 'zip':
             $zip = new ZipArchive();
Example #5
0
 }
 $is_img = false;
 $is_video = false;
 $is_audio = false;
 $show_original = false;
 $show_original_mini = false;
 $mini_src = "";
 $src_thumb = "";
 $extension_lower = fix_strtolower($file_array['extension']);
 if (in_array($extension_lower, $ext_img)) {
     $src = $base_url . $cur_dir . rawurlencode($file);
     $mini_src = $src_thumb = $thumbs_path . $subdir . $file;
     //add in thumbs folder if not exist
     if (!file_exists($src_thumb)) {
         try {
             create_img_gd($file_path, $src_thumb, 100, 50);
             new_thumbnails_creation($current_path . $rfm_subfolder . $subdir, $file_path, $file, $current_path, $relative_image_creation, $relative_path_from_current_pos, $relative_image_creation_name_to_prepend, $relative_image_creation_name_to_append, $relative_image_creation_width, $relative_image_creation_height, $relative_image_creation_option, $fixed_image_creation, $fixed_path_from_filemanager, $fixed_image_creation_name_to_prepend, $fixed_image_creation_to_append, $fixed_image_creation_width, $fixed_image_creation_height, $fixed_image_creation_option);
         } catch (Exception $e) {
             $src_thumb = $mini_src = "";
         }
     }
     $is_img = true;
     //check if is smaller than thumb
     list($img_width, $img_height, $img_type, $attr) = getimagesize($file_path);
     if ($img_width < 100 && $img_height < 50) {
         $src_thumb = $current_path . $rfm_subfolder . $subdir . $file;
         $show_original = true;
     }
     if ($img_width < 45 && $img_height < 38) {
         $mini_src = $current_path . $rfm_subfolder . $subdir . $file;
         $show_original_mini = true;
Example #6
0
 $file_relative_path = joinPaths($subdir, $file);
 $file_thumb_path = joinPaths($cur_thumbs_path, $file);
 $file_url = joinURL($cur_upload_url, $file);
 $file_thumb_url = joinURL($cur_thumbs_url, $file);
 if ($file != '.' && $file != '..' && $file[0] != '.' && !is_dir($file_path)) {
     $is_img = false;
     $is_video = false;
     $show_original = false;
     $file_ext = substr(strrchr($file, '.'), 1);
     if (in_array($file_ext, $ext)) {
         if (in_array($file_ext, $ext_img)) {
             $src = $file_url;
             $src_thumb = $file_thumb_url;
             //add to thumbs folder if not already
             if (!file_exists($file_thumb_path)) {
                 create_img_gd($file_path, $file_thumb_path, $thumbnail_width, $thumbnail_height);
             }
             $is_img = true;
             //check if is smaller than the thumb
             $info = getimagesize($file_path);
             if ($info[0] < $thumbnail_width && $info[2] < $thumbnail_height) {
                 $src_thumb = $file_url;
                 $show_original = true;
             }
         } elseif (file_exists('ico/' . strtoupper($file_ext) . ".png")) {
             $src = $src_thumb = 'ico/' . strtoupper($file_ext) . ".png";
         } else {
             $src = $src_thumb = "ico/Default.png";
         }
         if (in_array($file_ext, $ext_video)) {
             $class_ext = 4;
Example #7
0
         echo json_encode($info);
     }
     break;
 case 'save_img':
     $info = pathinfo($ttH->post['name']);
     if (strpos($ttH->post['path'], '/') === 0 || strpos($ttH->post['path'], '../') !== FALSE || strpos($ttH->post['path'], './') === 0 || strpos($ttH->post['url'], 'http://featherfiles.aviary.com/') !== 0 || $ttH->post['name'] != fix_filename($ttH->post['name'], $transliteration) || !in_array(strtolower($info['extension']), array('jpg', 'jpeg', 'png'))) {
         die('wrong data');
     }
     $image_data = get_file_by_url($ttH->post['url']);
     if ($image_data === false) {
         die('file could not be loaded');
     }
     file_put_contents($current_path . $ttH->post['path'] . $ttH->post['name'], $image_data);
     //new thumb creation
     //try{
     create_img_gd($current_path . $ttH->post['path'] . $ttH->post['name'], $thumbs_base_path . $ttH->post['path'] . $ttH->post['name'], 122, 91);
     new_thumbnails_creation($current_path . $ttH->post['path'], $current_path . $ttH->post['path'] . $ttH->post['name'], $ttH->post['name'], $current_path, $relative_image_creation, $relative_path_from_current_pos, $relative_image_creation_name_to_prepend, $relative_image_creation_name_to_append, $relative_image_creation_width, $relative_image_creation_height, $fixed_image_creation, $fixed_path_from_filemanager, $fixed_image_creation_name_to_prepend, $fixed_image_creation_to_append, $fixed_image_creation_width, $fixed_image_creation_height);
     /*} catch (Exception $e) {
     		$src_thumb=$mini_src="";
     	    }*/
     break;
 case 'extract':
     if (strpos($ttH->post['path'], '/') === 0 || strpos($ttH->post['path'], '../') !== FALSE || strpos($ttH->post['path'], './') === 0) {
         die('wrong path');
     }
     $path = $current_path . $ttH->post['path'];
     $info = pathinfo($path);
     $base_folder = $current_path . fix_dirname($ttH->post['path']) . "/";
     switch ($info['extension']) {
         case "zip":
             $zip = new ZipArchive();
Example #8
0
 $file_ext = substr(strrchr($file, '.'), 1);
 if ($file == '.' || $file == '..' || is_dir($root . $cur_dir . $file) || in_array($file, $hidden_files) || !in_array($file_ext, $ext)) {
     continue;
 }
 $is_img = false;
 $is_video = false;
 $show_original = false;
 $mini_src = "";
 $file_path = dirname(__FILE__) . DIRECTORY_SEPARATOR . $current_path . $subfolder . DIRECTORY_SEPARATOR . $subdir . $file;
 if (in_array($file_ext, $ext_img)) {
     $src = $base_url . $cur_dir . $file;
     $mini_src = $src_thumb = $thumbs_path . $subdir . $file;
     //add in thumbs folder if not exist
     $thumb_path = str_replace(DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR, dirname(__FILE__) . DIRECTORY_SEPARATOR . "thumbs" . DIRECTORY_SEPARATOR . $subfolder . DIRECTORY_SEPARATOR . $subdir . $file);
     if (!file_exists($thumb_path)) {
         create_img_gd($file_path, $thumb_path, 122, 91);
     }
     $is_img = true;
     //check if is smaller tha thumb
     list($img_width, $img_height, $img_type, $attr) = getimagesize($file_path);
     if ($img_width < 122 && $img_height < 91) {
         $src_thumb = $current_path . $subfolder . DIRECTORY_SEPARATOR . $subdir . $file;
         $show_original = true;
     }
 } elseif (file_exists('ico/' . strtoupper($file_ext) . ".png")) {
     $src_thumb = 'ico/' . strtoupper($file_ext) . ".png";
 } else {
     $src_thumb = "ico/Default.png";
 }
 if ($mini_src == "") {
     if (file_exists('ico/file_extension_' . strtolower($file_ext) . ".png")) {