4images code on GitHub Click here to visit GitHub.
0 Members and 1 Guest are viewing this topic.
Quote from: stb2) default display resized image, but make smthn. like button "hi res" to view an originalOn my site I use this MOD.And this mod automaticaly copy original file to /big/ folder if the image is being resized (/big/ folder also automaticaly created if its not exist).Just need use in Step 1. this code:Code: [Select]//--------------------------------------------//--------- Auto Image Resizing --------------//-------------------------------------------- if ($config['auto_image'] && !$uploaderror) { $src_copy = MEDIA_PATH."/".$cat_id."/big"; if ($direct_upload) { $src = MEDIA_PATH."/".$cat_id."/".$new_name; $src_copy = MEDIA_PATH."/".$cat_id."/big"; } else { $src = MEDIA_TEMP_PATH."/".$new_name; } $do_resize = 0; if ($image_info = @getimagesize($src)) { if ($image_info[2] == 1 || $image_info[2] == 2 || $image_info[2] == 3) { $do_resize = 1; } } if ($do_resize) { if (!function_exists(init_convert_options)) { require(ROOT_PATH.'includes/image_utils.php'); } $convert_options = init_convert_options(); if (!$convert_options['convert_error']) { if ($image_info[0] > $config['max_image_width'] || $image_info[1] > $config['max_image_height']) { $result = true; if (!@is_dir($src_copy)) { $oldumask = umask(0); $result = mkdir($src_copy); umask($oldumask); if (!@is_dir($src_copy) || !$result) { $result = mkdir($src_copy, 0755); } } if ($result == true){ copy($src, $src_copy."/".$new_name); } $convert_options = init_convert_options(); if (!$convert_options['convert_error']) { $quality = (intval($config['auto_image_quality']) && intval($config['auto_image_quality']) <= 100) ? intval($config['auto_image_quality']) : 100; if (!resize_image($src, $quality, $config['max_image_width'], 1)) { $msg .= (($msg != "") ? "<br />" : "")."<b>".$lang['file_upload_error'].": ".$new_name; $uploaderror = 1; } } }else{ $do_resize = 0; } } } }//-------------------------------------------P.S. it works on my windows system, dont know about any others
2) default display resized image, but make smthn. like button "hi res" to view an original
//--------------------------------------------//--------- Auto Image Resizing --------------//-------------------------------------------- if ($config['auto_image'] && !$uploaderror) { $src_copy = MEDIA_PATH."/".$cat_id."/big"; if ($direct_upload) { $src = MEDIA_PATH."/".$cat_id."/".$new_name; $src_copy = MEDIA_PATH."/".$cat_id."/big"; } else { $src = MEDIA_TEMP_PATH."/".$new_name; } $do_resize = 0; if ($image_info = @getimagesize($src)) { if ($image_info[2] == 1 || $image_info[2] == 2 || $image_info[2] == 3) { $do_resize = 1; } } if ($do_resize) { if (!function_exists(init_convert_options)) { require(ROOT_PATH.'includes/image_utils.php'); } $convert_options = init_convert_options(); if (!$convert_options['convert_error']) { if ($image_info[0] > $config['max_image_width'] || $image_info[1] > $config['max_image_height']) { $result = true; if (!@is_dir($src_copy)) { $oldumask = umask(0); $result = mkdir($src_copy); umask($oldumask); if (!@is_dir($src_copy) || !$result) { $result = mkdir($src_copy, 0755); } } if ($result == true){ copy($src, $src_copy."/".$new_name); } $convert_options = init_convert_options(); if (!$convert_options['convert_error']) { $quality = (intval($config['auto_image_quality']) && intval($config['auto_image_quality']) <= 100) ? intval($config['auto_image_quality']) : 100; if (!resize_image($src, $quality, $config['max_image_width'], 1)) { $msg .= (($msg != "") ? "<br />" : "")."<b>".$lang['file_upload_error'].": ".$new_name; $uploaderror = 1; } } }else{ $do_resize = 0; } } } }//-------------------------------------------
Step 6Go to Admin Control Panel -> settings. Under Upload settings u should find new options.