This MOD will resize uploaded by users images and thumbnails to Max. Image Width set in settings.
Working on v1.7 - v1.7.9
-----------------------------------------------
Files to edit:
member.php
includes/upload.php
admin/settings.php
lang/<yourlanguage>/admin.php-----------------------------------------------
Step 1Open
/member.phpFind:
if (!$uploaderror) {
Insert
above (if u installed "MOD Annotation by SLL" then, u'll need do
Step 7 too):
//--------------------------------------------
//--------- Auto Image Resizing --------------
//--------------------------------------------
if ($config['auto_image'] && !$uploaderror)
{
if ($direct_upload)
{
$src = MEDIA_PATH."/".$cat_id."/".$new_name;
}
else
{
$src = MEDIA_TEMP_PATH."/".$new_name;
}
$do_resize = 0;
if ($image_info = @getimagesize($src))
{
if ($image_info[2] > 0 && $image_info[2] < 4 && $image_info[0] > $config['max_image_width'] || $image_info[1] > $config['max_image_height'])
{
if (!function_exists("init_convert_options"))
{
require(ROOT_PATH.'includes/image_utils.php');
}
$convert_options = init_convert_options();
if (!$convert_options['convert_error'])
{
$quality = intval($config['auto_image_quality']);
$quality = ($quality >= 0 && $quality <= 100) ? $quality : 85;
if (!resize_image($src, $quality, $config['max_image_width'], 1, $config['max_image_height']))
{
$msg .= (($msg != "") ? "<br />" : "")."<b>".$lang['file_upload_error'].": ".$new_name;
$uploaderror = 1;
}
}
}
}
}
if ($config['auto_thumbnail'] && !$uploaderror)
{
if ($direct_upload)
{
$src = THUMB_PATH."/".$cat_id."/".$new_name;
}
else
{
$src = THUMB_TEMP_PATH."/".$new_name;
}
$do_resize = 0;
if ($image_info = @getimagesize($src))
{
if ($image_info[2] > 0 && $image_info[2] < 4 && $image_info[0] > $config['max_thumb_width'] || $image_info[1] > $config['max_thumb_height'])
{
if (!function_exists("init_convert_options"))
{
require(ROOT_PATH.'includes/image_utils.php');
}
$convert_options = init_convert_options();
if (!$convert_options['convert_error'])
{
$quality = intval($config['auto_image_quality']);
$quality = ($quality >= 0 && $quality <= 100) ? $quality : 85;
if (!resize_image($src, $quality, $config['max_thumb_width'], 1, $config['max_thumb_height']))
{
$msg .= (($msg != "") ? "<br />" : "")."<b>".$lang['file_upload_error'].": ".$new_name;
$uploaderror = 1;
}
}
}
}
}
//--- End Auto Image Resizing ----------------
Step 2Open
/includes/upload.phpFind:
$this->max_height['media'] = $config['max_image_height'];
Insert
below:
$this->auto_image['media'] = $config['auto_image'];
$this->auto_image['thumb'] = $config['auto_thumbnail'];
Step 2.2Find:
$this->image_size = @getimagesize($this->upload_file);
$ok = 1;
Insert
below:
if ($this->auto_image[$this->image_type]) {
return 1; //auto image is on, don't need check for anything else.
}
Step 3Open
/admin/settings.php Find:
show_setting_row("upload_emails");
Insert
below:
show_setting_row("auto_image", "radio");
show_setting_row("auto_image_quality");
Step 4Open
/lang/<yourlanguage>/admin.phpFind:
$setting['auto_thumbnail_quality'] = "Thumbnail quality<br /><span class=\"smalltext\">0 to 100</span>";
Insert
below:
$setting['auto_image'] = "Auto-resize image";
$setting['auto_image_quality'] = "Auto-resize image quality";
Step 5Download
attached file below.
Unzip it and upload to your 4images ROOT dir.
Execute it
http://yoursiteaddress/4images/install_autoimage.phpStep 6Go to Admin Control Panel -> settings.
Under Upload settings u should find new options. Make sure "Max. image size in KB" is set to a high enough number
Step 7This step u'll need only if u installed MOD Annotation by SLL
All u need to do is move code of Annotation, that u added in
member.php, move it below the code u added in
Step 1Step 8 (Added 19/09/04)This is an optional step, u'd need it if u want resize images not only using max width value as dimention but also max height.
Install atleast
Step 1.x from this fix:
[FIX] Max height has no affect when do image resizeVideo tutorial for this mod:http://www.asian-lady.org/tutors/resize-mod/resize-mod.htmlChanges logv2.0.1 (2010-12-18)
* Fixed: thumbnails not being resized by non-admins (re-do Step 2)
v2.0 (2010-12-12)
+ Added: thumbnails resize (more info and upgrade instructions
here)
v1.0 (2004-??-??)
- First release