Hi all,
One more great and usefull mod. Work perfect!!
I had only one problem:
If images_validate=true, images was resaized but no 'big' folder was created and original file not saved.
So I did some manipulations:
in file member.php find
//-----------------------------------------------------------
//----------------------- 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;
}
replace with:
//-----------------------------------------------------------
//----------------------- 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;
$src_copy = MEDIA_TEMP_PATH."/big";
}
in file admin/admin_functions.php find:
function copy_thumbnail($image_media_file, $image_thumb_file, $from_cat = 0, $to_cat = 0) {
Insert above:
function copy_big($image_media_file, $image_big_file, $from_cat = 0, $to_cat = 0) {
if (is_remote($image_big_file)) {
return $image_big_file
}
$image_src_big = (($from_cat != -1) ? MEDIA_PATH.(($from_cat != 0) ? "/".$from_cat : "") : MEDIA_TEMP_PATH)."/big";
$image_dest_big = (($to_cat != -1) ? MEDIA_PATH.(($to_cat != 0) ? "/".$to_cat : "") : MEDIA_TEMP_PATH)."/big";
$image_src_file_big = $image_src_big."/".$image_media_file;
if ($image_big_file != "" && file_exists($image_src_big."/".$image_big_file)) {
if (!@is_dir($image_dest_big)) {
$oldumask = umask(0);
$result = @mkdir($image_dest_big);
umask($oldumask);
if (!@is_dir($image_dest_big) || !$result) {
@mkdir($image_dest_big, CHMOD_DIRS);
}
}
$big_extension = get_file_extension($image_big_file);
$new_big = get_file_name($image_media_file).".".$big_extension;
if (file_exists($image_dest_big."/".$new_big)) {
unlink($image_dest_big."/".$new_big);
}
$ok = copy($image_src_big."/".$image_big_file, $image_dest_big."/".$new_big);
if ($ok) {
@unlink($image_src_file_big);
@chmod($image_dest_big."/".$new_big, CHMOD_FILES);
$image_big_file = $new_big;
}
if (!file_exists($image_dest_big."/".$new_big)) {
if (!copy($image_src_file_big, $image_dest_big."/".$new_big)) {
$error_log[] = sprintf($lang['copy_file_error_perm'], $image_src_file_big, $image_dest_big."/".$new_big);
}
}
}
return $image_big_file;
}
In file admin/validateimages/php find:
$old_thumb_path = THUMB_TEMP_PATH."/".$image_thumb_file;
Insert below:
if (file_exists( MEDIA_TEMP_PATH."/big/".$image_media_file ) ) { // Проверяем есть ли ориг. файл
$image_big_file = addslashes($image_cache[$key]['image_media_file']);
$old_big_path = MEDIA_TEMP_PATH."/big/".$image_big_file;
}
Find:
$new_thumb_name = copy_thumbnail($new_name, $image_thumb_file, "-1", $cat_id);
Insert below:
if ($old_big_path) {
$new_big_name = copy_big($new_name, $image_big_file, "-1", $cat_id);
}
Find:
@unlink($old_thumb_path);
Insert below:
if ($old_big_path) {
@unlink($old_big_path);
}
May be it's not right way to solve this problem, but it's work for me.
V@no, thank you for this mod!