Hello,
I saw some requests of making a SMF Gallery Quick Upload block So I made one.
There are 2 code snippets.1 is For left/right side and other is for center block.I made it using the main template function that Gallery uses so basically no credits to me.
- Uses all fields a normal Gallery upload box does
- Can be shown to guests but upload will be denied because of SMF Gallery Functionality
- Uses all fields in Left/Right side to
- No modification to code required
To be added in a phpblock.Tested with SMF Gallery Lite 1.7.X and TP 0.9.8 with SMF 1.1.2/3
For Center :
//Quick Gallery Upload Box(Center)
//Made by Dragooon.
//Credits are all to mod author since I used the
//Template Function in it.
global $scripturl, $modSettings, $db_prefix, $txt, $context, $settings, $boarddir;
require ($boarddir . '/Themes/default/languages/Gallery.english.php');
//Get the category
@$cat = (int) $_REQUEST['cat'];
echo '<div class="tborder">';
// Load the spell checker?
if ($context['show_spellchecking'])
echo '
<script language="JavaScript" type="text/javascript" src="', $settings['default_theme_url'], '/spellcheck.js"></script>';
echo '<form method="POST" enctype="multipart/form-data" name="picform" id="picform" action="' . $scripturl . '?action=gallery&sa=add2">
<table border="0" cellpadding="0" cellspacing="0" width="100%" height="129">
<tr class="catbg">
<td width="50%" colspan="2" height="19" align="center">
<b>' . $txt['gallery_form_addpicture'] . '</b></td>
</tr>
<tr class="windowbg2">
<td align="right"><b>' . $txt['gallery_form_title'] . '</b> </td>
<td><input type="text" name="title" /></td>
</tr>
<tr class="windowbg2">
<td align="right"><b>' . $txt['gallery_form_category'] . '</b> </td>
<td><select name="cat">';
$dbresult = db_query("SELECT ID_CAT, title FROM {$db_prefix}gallery_cat ORDER BY roworder ASC", __FILE__, __LINE__);
while($row = mysql_fetch_assoc($dbresult))
{
echo '<option value="' . $row['ID_CAT'] . '" ' . (($cat == $row['ID_CAT']) ? ' selected="selected"' : '') .'>' . $row['title'] . '</option>';
}
echo '</select>
</td>
</tr>
<tr class="windowbg2">
<td align="right"><b>' . $txt['gallery_form_description'] . '</b> </td>
<td><textarea name="description" rows="6" cols="55"></textarea>';
if ($context['show_spellchecking'])
echo '
<br /><input type="button" value="', $txt['spell_check'], '" onclick="spellCheck(\'picform\', \'description\');" />';
echo '
</td>
</tr>
<tr class="windowbg2">
<td align="right"><b>' . $txt['gallery_form_keywords'] . '</b> </td>
<td><input type="text" name="keywords" maxlength="100" />
</tr>
<tr class="windowbg2">
<td align="right"><b>' . $txt['gallery_form_uploadpic'] . '</b> </td>
<td><input type="file" size="48" name="picture" />';
if(!empty($modSettings['gallery_max_width']))
echo '<br />' . $txt['gallery_form_maxwidth'] . $modSettings['gallery_max_width'] . $txt['gallery_form_pixels'];
if(!empty($modSettings['gallery_max_height']))
echo '<br />' . $txt['gallery_form_maxheight'] . $modSettings['gallery_max_height'] . $txt['gallery_form_pixels'];
echo '
</td>
</tr>';
if(!empty($modSettings['gallery_commentchoice']))
{
echo '
<tr class="windowbg2">
<td align="right"><b>' . $txt['gallery_form_additionaloptions'] . '</b> </td>
<td><input type="checkbox" name="allowcomments" checked="checked" /><b>' . $txt['gallery_form_allowcomments'] .'</b>
</tr>';
}
echo '
<tr class="windowbg2">
<td width="28%" colspan="2" height="26" align="center" class="windowbg2">
<input type="submit" value="' . $txt['gallery_form_addpicture'] . '" name="submit" /><br />';
if(!allowedTo('smfgallery_autoapprove'))
echo $txt['gallery_form_notapproved'];
echo '
</td>
</tr>
</table>
</form>
</div>';
if ($context['show_spellchecking'])
if(function_exists('parse_bbc'))
echo '<form action="', $scripturl, '?action=spellcheck" method="post" accept-charset="', $context['character_set'], '" name="spell_form" id="spell_form" target="spellWindow"><input type="hidden" name="spellstring" value="" /></form>';
else
echo '<form name="spell_form" id="spell_form" method="post" target="spellWindow" action="', $scripturl, '?action=spellcheck"><input type="hidden" name="spell_formname" value="" /><input type="hidden" name="spell_fieldname" value="" /><input type="hidden" name="spellstring" value="" /></form>';
This one was for center blocks,
If you want one for left/right here is the code:
//Quick Gallery Upload Box(Left/Right side)
//Made by Dragooon.
//Credits are all to mod author since I used the
//Template Function in it.
global $scripturl, $modSettings, $db_prefix, $txt, $context, $settings, $boarddir;
require($boarddir . '/Themes/default/languages/Gallery.english.php');
//Get the category
@$cat = (int) $_REQUEST['cat'];
echo '<div class="tborder">';
// Load the spell checker?
if ($context['show_spellchecking'])
echo '
<script language="JavaScript" type="text/javascript" src="', $settings['default_theme_url'], '/spellcheck.js"></script>';
echo '<form method="POST" enctype="multipart/form-data" name="picform" id="picform" action="' . $scripturl . '?action=gallery&sa=add2">
<table border="0" cellpadding="0" cellspacing="0" width="100%" height="129">
<tr class="catbg">
<td width="50%" colspan="2" height="19" align="left">
<b>' . $txt['gallery_form_addpicture'] . '</b></td>
</tr>
<tr class="windowbg2">
<td align="left"><b>' . $txt['gallery_form_title'] . '<br></b>
<input type="text" name="title" /></td>
</tr>
<tr class="windowbg2">
<td align="left"><b><br><br>' . $txt['gallery_form_category'] . '</b>
<select name="cat">';
$dbresult = db_query("SELECT ID_CAT, title FROM {$db_prefix}gallery_cat ORDER BY roworder ASC", __FILE__, __LINE__);
while($row = mysql_fetch_assoc($dbresult))
{
echo '<option value="' . $row['ID_CAT'] . '" ' . (($cat == $row['ID_CAT']) ? ' selected="selected"' : '') .'>' . $row['title'] . '</option>';
}
echo '</select>
</td>
</tr>
<br><br><tr class="windowbg2">
<td align="left"><b><br><br>' . $txt['gallery_form_description'] . '</b>
<textarea name="description" rows="3" cols="15"></textarea>';
if ($context['show_spellchecking'])
echo '
<br /><input type="button" value="', $txt['spell_check'], '" onclick="spellCheck(\'picform\', \'description\');" />';
echo '
</td>
</tr>
<tr class="windowbg2">
<td align="left"><b><br><br>' . $txt['gallery_form_keywords'] . '</b>
<input type="text" name="keywords" maxlength="100" />
</tr>
<tr class="windowbg2">
<td align="left"><b><br><br>' . $txt['gallery_form_uploadpic'] . '<br></b>
<input type="file" size="10" name="picture" />';
if(!empty($modSettings['gallery_max_width']))
echo '<br />' . $txt['gallery_form_maxwidth'] . $modSettings['gallery_max_width'] . $txt['gallery_form_pixels'];
if(!empty($modSettings['gallery_max_height']))
echo '<br />' . $txt['gallery_form_maxheight'] . $modSettings['gallery_max_height'] . $txt['gallery_form_pixels'];
echo '
</td>
</tr>';
if(!empty($modSettings['gallery_commentchoice']))
{
echo '
<tr class="windowbg2">
<td align="left"><b>' . $txt['gallery_form_additionaloptions'] . '</b>
<input type="checkbox" name="allowcomments" checked="checked" /><b>' . $txt['gallery_form_allowcomments'] .'</b>
</tr>';
}
echo '
<tr class="windowbg2">
<td width="28%" colspan="2" height="26" align="left" class="windowbg2">
<input type="submit" value="' . $txt['gallery_form_addpicture'] . '" name="submit" /><br />';
if(!allowedTo('smfgallery_autoapprove'))
echo $txt['gallery_form_notapproved'];
echo '
</td>
</tr>
</table>
</form>
</div>';
if ($context['show_spellchecking'])
if(function_exists('parse_bbc'))
echo '<form action="', $scripturl, '?action=spellcheck" method="post" accept-charset="', $context['character_set'], '" name="spell_form" id="spell_form" target="spellWindow"><input type="hidden" name="spellstring" value="" /></form>';
else
echo '<form name="spell_form" id="spell_form" method="post" target="spellWindow" action="', $scripturl, '?action=spellcheck"><input type="hidden" name="spell_formname" value="" /><input type="hidden" name="spell_fieldname" value="" /><input type="hidden" name="spellstring" value="" /></form>';
Demo can be found at my crappy test site -
http://gforumx.com/tst
Hope you like it.
Hi..dragoon,its a nice block,thanks,I install in my site
Oh,,where can I the theme FerryTema download,pleas post a link to zip file.
Hehe Sorry But I cant release it.
I converted it but I dont still got permission to release it.
Thanks,,I wait antill you release it?about one weak!!
I dont know.It all depends on when I'll get my permission.
Ok,can you tell mi from where you convertet it and how,Thanks
Sure
http://www.cripcan.com/cripconvert.htm