[RC1]Smartor Gallery - minimum image size

A place for MOD Authors to post and receive feedback on MODs still in development. No MODs within this forum should be used within a live environment! No new topics are allowed in this forum.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

IMPORTANT: MOD Development Forum rules

On February 1, 2009 this forum will be set to read only as part of retiring of phpBB2.
Post Reply
Alex Zuyev
Registered User
Posts: 32
Joined: Sun Dec 28, 2003 1:47 pm
Location: Moscow
Contact:

[RC1]Smartor Gallery - minimum image size

Post by Alex Zuyev »

Hallo.
Some galleries based on Smartor module need to have bouth functions: max and min height/widht. But basic release

of the gallery doesn't have one - minimum sizes. Here is my mod that allow to set minimum pic size.

##############################################################
## MOD Title: image resize
## MOD Author: Alex (N/A) http://www.piercing.ru
## MOD Description: Minimum height/widht values for Smartor Gallery
## MOD Version: 1.0.0
##
## Installation Level: Easy
## Installation Time: ~10 Minutes
## Files To Edit: 5
## album_upload.php
## admin/admin_album_config.php
## templates/subSilver/album_upload_body.tpl
## templates/subSilver/admin/album_config_body.tpl
## language/lang_english/lang_main_album.php
##
## MySQL: add 2 rows
## Included Files: n/a
##############################################################
## For Security Purposes, Please Check: http://www.phpbb.com/mods/ for the
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered
## in our MOD-Database, located at: http://www.phpbb.com/mods/
##############################################################
## Author Notes:
##
## demo board: http://www.piercing.ru/phpBB/album.php
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################

#
#-----[ SQL ]------------------------------------------
#
ALTER TABLE phpbb_album_config
INSERT INTO phpbb_album_config VALUES (min_height, 768);
INSERT INTO phpbb_album_config VALUES (min_width, 768);

#
#-----[ OPEN ]------------------------------------------
#

album_upload.php

#
#-----[ FIND ]------------------------------------------
#
'L_ALLOWED_JPG' => $lang['JPG_allowed'],

#
#-----[ BEFORE, ADD ]------------------------------------------
#

'L_MIN_WIDTH' => $lang['Min_width'],
'L_MIN_HEIGHT' => $lang['Min_height'],

'S_MIN_WIDTH' => $album_config['min_width'],
'S_MIN_HEIGHT' => $album_config['min_height'],

#
#-----[ FIND ]------------------------------------------
#

message_die(GENERAL_ERROR, $lang['Upload_image_size_too_big']);
}

#
#-----[ AFTER, ADD ]------------------------------------------
#

if ( ($pic_width < $album_config['min_width']) or ($pic_height < $album_config['min_height']) )
{
@unlink(ALBUM_UPLOAD_PATH . $pic_filename);

if ($album_config['gd_version'] == 0)
{
@unlink(ALBUM_CACHE_PATH . $pic_thumbnail);
}

message_die(GENERAL_ERROR, $lang['Upload_image_size_too_small']);
}

#
#-----[ OPEN ]------------------------------------------
#

admin/admin_album_config.php

#
#-----[ FIND ]------------------------------------------
#

'ROWS_PER_PAGE' => $new['rows_per_page'],

#
#-----[ BEFORE, ADD ]------------------------------------------
#

'MIN_WIDTH' => $new['min_width'],
'MIN_HEIGHT' => $new['min_height'],

#
#-----[ FIND ]------------------------------------------
#

'L_USER_PICS_LIMIT' => $lang['User_pics_limit'],

#
#-----[ BEFORE, ADD ]------------------------------------------
#

'L_MIN_WIDTH' => $lang['Min_width'],
'L_MIN_HEIGHT' => $lang['Min_height'],

#
#-----[ OPEN ]------------------------------------------
#

templates/subSilver/album_upload_body.tpl

#
#-----[ FIND ]------------------------------------------
#

<tr>
<td class="row1" height="28"><span class="gen">{L_MAX_WIDTH}:</span></td>
<td class="row2"><span class="gen"><b>{S_MAX_WIDTH}</b></span></td>
</tr>
<tr>
<td class="row1" height="28"><span class="gen">{L_MAX_HEIGHT}:</span></td>
<td class="row2"><span class="gen"><b>{S_MAX_HEIGHT}</b></span></td>
</tr>

#
#-----[ REPLACE WITH ]------------------------------------------
#

<tr>
<td class="row1" height="28"><span class="gen">{L_MIN_WIDTH}/{L_MAX_WIDTH}:</span></td>
<td class="row2"><span class="gen"><b>{S_MIN_WIDTH}/{S_MAX_WIDTH}</b></span></td>
</tr>
<tr>
<td class="row1" height="28"><span class="gen">{L_MIN_HEIGHT}/{L_MAX_HEIGHT}:</span></td>
<td class="row2"><span class="gen"><b>{S_MIN_HEIGHT}/{S_MAX_HEIGHT}</b></span></td>
</tr>

#
#-----[ OPEN ]------------------------------------------
#

templates/subSilver/admin/album_config_body.tpl

#
#-----[ FIND ]------------------------------------------
#

<tr>
<td class="row1"><span class="genmed">{L_MAX_WIDTH}</span></td>
<td class="row2"><input class="post" type="text" maxlength="9" size="9" name="max_width"

value="{MAX_WIDTH}" /></td>
</tr>
<tr>
<td class="row1"><span class="genmed">{L_MAX_HEIGHT}</span></td>
<td class="row2"><input class="post" type="text" maxlength="9" size="9" name="max_height"

value="{MAX_HEIGHT}" /></td>
</tr>,

#
#-----[ REPLACE WITH ]------------------------------------------
#

<tr>
<td class="row1"><span class="genmed">{L_MIN_WIDTH}-{L_MAX_WIDTH}</span></td>
<td class="row2"><input class="post" type="text" maxlength="9" size="9" name="min_width"

value="{MIN_WIDTH}" />-<input class="post" type="text" maxlength="9" size="9" name="max_width" value="{MAX_WIDTH}"

/></td>
</tr>
<tr>
<td class="row1"><span class="genmed">{L_MIN_HEIGHT}-{L_MAX_HEIGHT}</span></td>
<td class="row2"><input class="post" type="text" maxlength="9" size="9" name="min_height"

value="{MIN_HEIGHT}" />-<input class="post" type="text" maxlength="9" size="9" name="max_height"

value="{MAX_HEIGHT}" /></td>
</tr>

#
#-----[ OPEN ]------------------------------------------
#

language/lang_english/lang_main_album.php

#
#-----[ FIND ]------------------------------------------
#

$lang['JPG_allowed']

#
#-----[ BEFORE, ADD ]------------------------------------------
#

$lang['Min_width'] = 'Min';
$lang['Min_height'] = 'Min';

#
#-----[ FIND ]------------------------------------------
#

$lang['Upload_thumbnail_size_too_big']

#
#-----[ BEFORE, ADD ]------------------------------------------
#

$lang['Upload_image_size_too_small'] = 'Your picture is too small';

#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM
Best wishes,
Alex

Post Reply

Return to “[2.0.x] MODs in Development”