This mod will add a minimum width/height and size requirements for new uploaded images.
----------- [ Changed files ] -------------admin/settings.php
includes/upload.php
lang/<yourlangauge>/admin.php
lang/<yourlangauge>/main.php
----------- [ Installataion ] -------------Step 1 Open
admin/settings.php Find:
show_setting_row("max_thumb_width");
show_setting_row("max_thumb_height");
show_setting_row("max_thumb_size");
show_setting_row("max_image_width");
show_setting_row("max_image_height");
show_setting_row("max_media_size");
Replace with:
show_setting_row("max_thumb_width");
show_setting_row("max_thumb_height");
show_setting_row("max_thumb_size");
show_setting_row("min_thumb_width");
show_setting_row("min_thumb_height");
show_setting_row("min_thumb_size");
show_setting_row("max_image_width");
show_setting_row("max_image_height");
show_setting_row("max_media_size");
show_setting_row("min_image_width");
show_setting_row("min_image_height");
show_setting_row("min_media_size");
Step 2 Open
includes/upload.php Find:
var $max_size = array();
Insert
below:
var $min_width = array();
var $min_height = array();
var $min_size = array();
Step 2.1 Find:
$this->max_size['media'] = $config['max_media_size'] * 1024;
Insert
below:
$this->min_width['thumb'] = $config['min_thumb_width'];
$this->min_width['media'] = $config['min_image_width'];
$this->min_height['thumb'] = $config['min_thumb_height'];
$this->min_height['media'] = $config['min_image_height'];
$this->min_size['thumb'] = $config['min_thumb_size'] * 1024;
$this->min_size['media'] = $config['min_media_size'] * 1024;
Step 2.2Find:
$this->image_size = @getimagesize($this->upload_file);
$ok = 1;
Insert
below:
if ($this->image_size[0] < $this->min_width[$this->image_type]) {
$ok = 0;
$this->set_error($this->lang['invalid_image_width_min']);
}
if ($this->image_size[1] < $this->min_height[$this->image_type]) {
$ok = 0;
$this->set_error($this->lang['invalid_image_height_min']);
}
Step 2.3 Find:
function save_file() {
Insert
above:
function check_min_filesize() {
if ($this->HTTP_POST_FILES[$this->field_name]['size'] < $this->min_size[$this->image_type]) {
return false;
}
else {
return true;
}
}
Step 2.4 Find:
if (eregi("image", $this->HTTP_POST_FILES[$this->field_name]['type'])) {
Insert
above:
if (!$this->check_min_filesize()) {
$this->set_error($this->lang['invalid_file_size_min']);
$ok = 0;
}
Step 3 Open
lang/<yourlangauge>/admin.php Find:
$auto_thumbnail_resize_type_optionlist = array(
Insert
above:
$setting['min_thumb_width'] = "Min. width of thumbnail in pixel";
$setting['min_thumb_height'] = "Min. heigth of thumbnail in pixel";
$setting['min_thumb_size'] = "Min. thumbnail size in KB";
$setting['min_image_width'] = "Min. image width in pixel";
$setting['min_image_height'] = "Min. image heigth in pixel";
$setting['min_media_size'] = "Min. image size in KB";
Step 4 Open
lang/<yourlangauge>/main.php At the end,
above closing
?> insert this:
$lang['min_filesize'] = "Min. File Size: ";
$lang['min_imagewidth'] = "Min. Image Width: ";
$lang['min_imageheight'] = "Min. Image Height: ";
$lang['invalid_image_width_min'] = "Image width invalid";
$lang['invalid_image_height_min'] = "Image heigth invalid";
$lang['invalid_file_size_min'] = "Image size invalid";
Step 5 Download
this database updater
Unpack it and upload to your 4images root diretory.
Execute it by typing in your browser
http://<yoursiteaddress>/install_min_upload.php and follow the instructions.
After all this done, u should see new settings under "Upload settings" section in ACP->Settings.
P.S. your 4images administrator will not be affected by any of the upload restrictions! Test it as a regular member or as a guest.