Topic: Add image

How do i add image before topic? Every topic must have unique image. Sorry for my bad english.

Re: Add image

Where would you like the image to be displayed? Do you want to upload the image when posting?

Sorry. Unactive due to personal life.

3 (edited by mara666 2009-04-04 12:18)

Re: Add image

Utchin wrote:

Where would you like the image to be displayed? Do you want to upload the image when posting?

I want image displayed in Topic.

http://www.zavolejnam.cz/11/12345.jpg

4

Re: Add image

Quiero saber lo mismo. Cómo pongo un icono al lado de los hilos?

Por otro lado... ¿La versión 1.3 no permite bajar e instalar plugins automaticamente? Cómo hago para que los reconozca?

Primero lo primero. Cuenten como poner iconos. En todo el sitio no encuentro ningun -ico que reemplazar.

5

Re: Add image

I mean... how should I replace the native icon? I{d like to put another icon besides the topics... How to? Please.

Re: Add image

Pls help me...

7 (edited by Scripter 2009-09-25 01:05)

Re: Add image

mara666 wrote:

Pls help me...

Do you want a different image for every post indicators? BTW Porno link in tab :0

[img]http://img90.imageshack.us/img90/746/scripter8ko.png[/img]
http://openwings.co.cc

8 (edited by frankpeng 2011-11-03 03:38)

Re: Add image

##
##
##        Mod title:  Topic Image
##
##      Mod version:  1.0
##   Works on PunBB:  1.2.x
##     Release date:  2008-10-24
##           Author:  downliner ( willvilliers.com/forum.php )
##
##      Description:  Display an image on viewforum.php with each topic.
##                Similiar to Topic Icons only this allows any image URL to be entered and displayed.
##
##   Affected files:  post.php
##                lang/English/common.php

##                edit.php
##                viewforum.php
##
##       Affects DB:  Yes. Adds one column to 'topics'.
##
##            Notes:  PLEASE BACKUP THE ABOVE 4 LISTED FILES BEFORE INSTALLING THIS MOD!
##                IF YOU'RE UNCOMFORTABLE INSTALLING MODS/EDITING CODE DROP ME AN EMAIL :)
##
##       DISCLAIMER:  Please note that "mods" are not officially supported by
##                    PunBB. Installation of this modification is done at your
##                    own risk. Backup your forum database and any and all
##                    applicable files before proceeding.
##
##


#
#---------[x. UPLOAD ]----------------------------------------------
#

install_mod.php


#
#---------[x. RUN ]----------------------------------------------
#

install_mod.php


#
#---------[x. DELETE ]----------------------------------------------
#

install_mod.php


#
#---------[ 1. OPEN ]----------------------------------------------------------
#

post.php

#
#---------[ 2. FIND (line:41) ]----------------------------------------------------------
#

if ($tid)
    $result = $db->query('SELECT f.id, f.forum_name, f.moderators, f.redirect_url, fp.post_replies, fp.post_topics, t.subject, t.closed FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.id='.$tid) or error('Unable to fetch forum info', __FILE__, __LINE__, $db->error());
else

#
#---------[ 3. REPLACE WITH ]----------------------------------------------------------
#

if ($tid)
    $result = $db->query('SELECT f.id, f.forum_name, f.moderators, f.redirect_url, fp.post_replies, fp.post_topics, t.subject, t.topicimage, t.closed FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.id='.$tid) or error('Unable to fetch forum info', __FILE__, __LINE__, $db->error());
else

#
#---------[ 4. FIND (line:93) ]----------------------------------------------------------
#

        else if ($pun_config['p_subject_all_caps'] == '0' && strtoupper($subject) == $subject && $pun_user['g_id'] > PUN_MOD)
            $subject = ucwords(strtolower($subject));

#
#---------[ 5. ADD AFTER !!! ]----------------------------------------------------------
#

            $topicimage = $_POST['topicimage'];

#
#---------[ 6. FIND (line:287) ]----------------------------------------------------------
#

            // Create the topic
            $db->query('INSERT INTO '.$db->prefix.'topics (poster, subject, posted, last_post, last_poster, forum_id) VALUES(\''.$db->escape($username).'\', \''.$db->escape($subject).'\', '.$now.', '.$now.', \''.$db->escape($username).'\', '.$fid.')') or error('Unable to create topic', __FILE__, __LINE__, $db->error());

#
#---------[ 7. REPLACE WITH ]----------------------------------------------------------
#

            // Create the topic
            $db->query('INSERT INTO '.$db->prefix.'topics (poster, subject, posted, last_post, last_poster, forum_id, topicimage) VALUES(\''.$db->escape($username).'\', \''.$db->escape($subject).'\', '.$now.', '.$now.', \''.$db->escape($username).'\', '.$fid.', \''.$db->escape($topicimage).'\')') or error('Unable to create topic', __FILE__, __LINE__, $db->error());

#
#---------[ 8. FIND (line:491) ]----------------------------------------------------------
#

if ($fid): ?>
                        <label><strong><?php echo $lang_common['Subject'] ?></strong><br /><input class="longinput" type="text" name="req_subject" value="<?php if (isset($_POST['req_subject'])) echo pun_htmlspecialchars($subject); ?>" size="80" maxlength="70" tabindex="<?php echo $cur_index++ ?>" /><br /></label>
<?php endif; ?>                        <label><strong><?php echo $lang_common['Message'] ?></strong><br />


#
#---------[ 9. REPLACE WITH !!! ]----------------------------------------------------------
#

if ($fid): ?>
                        <label><strong><?php echo $lang_common['Subject'] ?></strong><br /><input class="longinput" type="text" name="req_subject" value="<?php if (isset($_POST['req_subject'])) echo pun_htmlspecialchars($subject); ?>" size="80" maxlength="70" tabindex="<?php echo $cur_index++ ?>" /><br /></label>
<?php endif; ?>

<?php 
if ($fid AND $pun_user['g_id'] == 1): ?>
                        <label><strong><?php echo $lang_common['TopicImage'] ?></strong><br /><input class="longinput" type="text" name="topicimage" value="<?php if (isset($_POST['topicimage'])) echo pun_htmlspecialchars($topicimage); ?>" size="80" /><br /></label>
<?php endif; ?>                        <label><strong><?php echo $lang_common['Message'] ?></strong><br />


#
#---------[ 10. OPEN ]----------------------------------------------------------
#

lang/English/common.php

#
#---------[ 11. FIND (line: 78) ]----------------------------------------------------------
#

'Subject'                =>    'Subject',

#
#---------[ 12. ADD AFTER !!! ]----------------------------------------------------------
#

'TopicImage'                =>    'Topic Image URL',

#
#---------[ 13. OPEN ]----------------------------------------------------------
#

edit.php

#
#---------[ 14. FIND (line:39) ]----------------------------------------------------------
#

// Fetch some info about the post, the topic and the forum
$result = $db->query('SELECT f.id AS fid, f.forum_name, f.moderators, f.redirect_url, fp.post_replies, fp.post_topics, t.id AS tid, t.subject, t.posted, t.closed, p.poster, p.poster_id, p.message, p.hide_smilies FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'topics AS t ON t.id=p.topic_id INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND p.id='.$id) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());

#
#---------[ 15. REPLACE WITH ]----------------------------------------------------------
#

// Fetch some info about the post, the topic and the forum
$result = $db->query('SELECT f.id AS fid, f.forum_name, f.moderators, f.redirect_url, fp.post_replies, fp.post_topics, t.id AS tid, t.subject, t.topicimage, t.posted, t.closed, p.poster, p.poster_id, p.message, p.hide_smilies FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'topics AS t ON t.id=p.topic_id INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND p.id='.$id) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());

#
#---------[ 16. FIND (line:84) ]----------------------------------------------------------
#
:
        else if ($pun_config['p_subject_all_caps'] == '0' && strtoupper($subject) == $subject && $pun_user['g_id'] > PUN_MOD)
            $subject = ucwords(strtolower($subject));

#
#---------[ 17. ADD AFTER !!! ]----------------------------------------------------------
#

            $topicimage = $_POST['topicimage'];

#
#---------[ 18. FIND (line:117) ]----------------------------------------------------------
#

            // Update the topic and any redirect topics
            $db->query('UPDATE '.$db->prefix.'topics SET subject=\''.$db->escape($subject).'\' WHERE id='.$cur_post['tid'].' OR moved_to='.$cur_post['tid']) or error('Unable to update topic', __FILE__, __LINE__, $db->error());

#
#---------[ 19. ADD AFTER !!! ]----------------------------------------------------------
#

            // Update the topic image?
            $db->query('UPDATE '.$db->prefix.'topics SET topicimage=\''.$db->escape($topicimage).'\' WHERE id='.$cur_post['tid']) or error('Unable to update topic image', __FILE__, __LINE__, $db->error());

#
#---------[ 20. FIND (line:209) ]----------------------------------------------------------
#

<?php if ($can_edit_subject): ?>                        <label><?php echo $lang_common['Subject'] ?><br />
                        <input class="longinput" type="text" name="req_subject" size="80" maxlength="70" tabindex="<?php echo $cur_index++ ?>" value="<?php echo pun_htmlspecialchars(isset($_POST['req_subject']) ? $_POST['req_subject'] : $cur_post['subject']) ?>" /><br /></label>
<?php endif; ?>                        <label><?php echo $lang_common['Message'] ?><br />

#
#---------[ 21. REPLACE WITH ]----------------------------------------------------------
#

<?php if ($can_edit_subject): ?>                        <label><?php echo $lang_common['Subject'] ?><br />
                        <input class="longinput" type="text" name="req_subject" size="80" maxlength="70" tabindex="<?php echo $cur_index++ ?>" value="<?php echo pun_htmlspecialchars(isset($_POST['req_subject']) ? $_POST['req_subject'] : $cur_post['subject']) ?>" /><br /></label>
<?php endif; ?>
////////////
<?php 

if ($pun_user['g_id'] == 1): ?>
                        <label><strong><?php echo $lang_common['TopicImage'] ?></strong><br />
                        <input class="longinput" type="text" name="topicimage" size="80" maxlength="70" tabindex="<?php echo $cur_index++ ?>" value="<?php echo pun_htmlspecialchars(isset($_POST['topicimage']) ? $_POST['topicimage'] : $cur_post['topicimage']) ?>" /><br /></label>
<?php endif; ?>            
////////////////////////////
////////////


            <label><?php echo $lang_common['Message'] ?><br />


#
#---------[ 22. OPEN ]----------------------------------------------------------
#

viewforum.php


#
#---------[ 23. FIND (line:112) ]----------------------------------------------------------
#

    // Without "the dot"
    $sql = 'SELECT id, poster, subject, posted, last_post, last_post_id, last_poster, num_views, num_replies, closed, sticky, moved_to FROM '.$db->prefix.'topics WHERE forum_id='.$id.' ORDER BY sticky DESC, '.(($cur_forum['sort_by'] == '1') ? 'posted' : 'last_post').' DESC LIMIT '.$start_from.', '.$pun_user['disp_topics'];


#
#---------[ 24. REPLACE WITH ]----------------------------------------------------------
#

    // Without "the dot"
    $sql = 'SELECT id, poster, subject, posted, last_post, last_post_id, last_poster, num_views, num_replies, closed, sticky, moved_to, topicimage FROM '.$db->prefix.'topics WHERE forum_id='.$id.' ORDER BY sticky DESC, '.(($cur_forum['sort_by'] == '1') ? 'posted' : 'last_post').' DESC LIMIT '.$start_from.', '.$pun_user['disp_topics'];

#
#---------[ 25. FIND (line:122) ]----------------------------------------------------------
#

        case 'mysqli':
            $sql = 'SELECT p.poster_id AS has_posted, t.id, t.subject, t.poster, t.posted, t.last_post, t.last_post_id, t.last_poster, t.num_views, t.num_replies, t.closed, t.sticky, t.moved_to FROM '.$db->prefix.'topics AS t LEFT JOIN '.$db->prefix.'posts AS p ON t.id=p.topic_id AND p.poster_id='.$pun_user['id'].' WHERE t.forum_id='.$id.' GROUP BY t.id ORDER BY sticky DESC, '.(($cur_forum['sort_by'] == '1') ? 'posted' : 'last_post').' DESC LIMIT '.$start_from.', '.$pun_user['disp_topics'];
            break;

#
#---------[ 26. REPLACE WITH ]----------------------------------------------------------
#

        case 'mysqli':
            $sql = 'SELECT p.poster_id AS has_posted, t.id, t.subject, t.poster, t.posted, t.last_post, t.last_post_id, t.last_poster, t.num_views, t.num_replies, t.closed, t.sticky, t.moved_to, t.topicimage FROM '.$db->prefix.'topics AS t LEFT JOIN '.$db->prefix.'posts AS p ON t.id=p.topic_id AND p.poster_id='.$pun_user['id'].' WHERE t.forum_id='.$id.' GROUP BY t.id ORDER BY sticky DESC, '.(($cur_forum['sort_by'] == '1') ? 'posted' : 'last_post').' DESC LIMIT '.$start_from.', '.$pun_user['disp_topics'];
            break;

#
#---------[ 27. FIND (line:126) ]----------------------------------------------------------
#

        case 'sqlite':
            $sql = 'SELECT p.poster_id AS has_posted, t.id, t.subject, t.poster, t.posted, t.last_post, t.last_post_id, t.last_poster, t.num_views, t.num_replies, t.closed, t.sticky, t.moved_to FROM '.$db->prefix.'topics AS t LEFT JOIN '.$db->prefix.'posts AS p ON t.id=p.topic_id AND p.poster_id='.$pun_user['id'].' WHERE t.id IN(SELECT id FROM '.$db->prefix.'topics WHERE forum_id='.$id.' ORDER BY sticky DESC, '.(($cur_forum['sort_by'] == '1') ? 'posted' : 'last_post').' DESC LIMIT '.$start_from.', '.$pun_user['disp_topics'].') GROUP BY t.id ORDER BY t.sticky DESC, t.last_post DESC';
            break;

#
#---------[ 28. REPLACE WITH ]----------------------------------------------------------
#

        case 'sqlite':
            $sql = 'SELECT p.poster_id AS has_posted, t.id, t.subject, t.poster, t.posted, t.last_post, t.last_post_id, t.last_poster, t.num_views, t.num_replies, t.closed, t.sticky, t.moved_to, t.topicimage FROM '.$db->prefix.'topics AS t LEFT JOIN '.$db->prefix.'posts AS p ON t.id=p.topic_id AND p.poster_id='.$pun_user['id'].' WHERE t.id IN(SELECT id FROM '.$db->prefix.'topics WHERE forum_id='.$id.' ORDER BY sticky DESC, '.(($cur_forum['sort_by'] == '1') ? 'posted' : 'last_post').' DESC LIMIT '.$start_from.', '.$pun_user['disp_topics'].') GROUP BY t.id ORDER BY t.sticky DESC, t.last_post DESC';
            break;

#
#---------[ 29. FIND (line:130) ]----------------------------------------------------------
#

        default:
            $sql = 'SELECT p.poster_id AS has_posted, t.id, t.subject, t.poster, t.posted, t.last_post, t.last_post_id, t.last_poster, t.num_views, t.num_replies, t.closed, t.sticky, t.moved_to FROM '.$db->prefix.'topics AS t LEFT JOIN '.$db->prefix.'posts AS p ON t.id=p.topic_id AND p.poster_id='.$pun_user['id'].' WHERE t.forum_id='.$id.' GROUP BY t.id, t.subject, t.poster, t.posted, t.last_post, t.last_post_id, t.last_poster, t.num_views, t.num_replies, t.closed, t.sticky, t.moved_to, p.poster_id ORDER BY sticky DESC, '.(($cur_forum['sort_by'] == '1') ? 'posted' : 'last_post').' DESC LIMIT '.$start_from.', '.$pun_user['disp_topics'];
            break;

#
#---------[ 30. REPLACE WITH ]----------------------------------------------------------
#

        default:
            $sql = 'SELECT p.poster_id AS has_posted, t.id, t.subject, t.poster, t.posted, t.last_post, t.last_post_id, t.last_poster, t.num_views, t.num_replies, t.closed, t.sticky, t.moved_to, t.topicimage FROM '.$db->prefix.'topics AS t LEFT JOIN '.$db->prefix.'posts AS p ON t.id=p.topic_id AND p.poster_id='.$pun_user['id'].' WHERE t.forum_id='.$id.' GROUP BY t.id, t.subject, t.poster, t.posted, t.last_post, t.last_post_id, t.last_poster, t.num_views, t.num_replies, t.closed, t.sticky, t.moved_to, t.topicimage, p.poster_id ORDER BY sticky DESC, '.(($cur_forum['sort_by'] == '1') ? 'posted' : 'last_post').' DESC LIMIT '.$start_from.', '.$pun_user['disp_topics'];
            break;

#
#---------[ 31. FIND (line:206) ]----------------------------------------------------------
#

?>
                <tr<?php if ($item_status != '') echo ' class="'.trim($item_status).'"'; ?>>

#
#---------[ 32. ADD BEFORE !!! ]----------------------------------------------------------
#

        if ($topicimage != '')
            $topicimage = '<a href="viewtopic.php?id='.$cur_topic['id'].'" title="'.pun_htmlspecialchars($cur_topic['subject']).'"><img src="'.pun_htmlspecialchars($cur_topic['topicimage']).'" alt="'.pun_htmlspecialchars($cur_topic['subject']).'" class="topicimage" /></a>';
        else
        {
            $topicimage = '&nbsp;';
        }




#
#---------[ 33. FIND (line:213) ]----------------------------------------------------------
#

                                <?php echo $subject."\n" ?>


#
#---------[ 34. ADD BEFORE !!! ]----------------------------------------------------------
#

                                <?php echo $topicimage ?>

#
#---------[ 35. OPEN ]----------------------------------------------------------
#

style/YOUR_STYLE.css


#
#---------[ 36. ADD TO THE VERY BOTTOM OF FILE ]-------------------------------------------------
#

.topicimage {    float: right;
            width:75px;
            height: 50px;
            padding: 1px;
            border: 1px solid! important;
            margin-left: 10px ! important;}


#--------------[ NOTE ]-------------------------------------------------------------------------------------#
#                                                                        #
# You must repeat steps 33 and 34 for each stylesheet your site offers (i.e Oxygen, Sulfur, etc)        #
#                                                                        #
# During step 34 please ensure that the preceeding style declaration contains its closing curly bracket.    #
# If using a default style (i.e Oxygen) then you should be adding the code in step 34 /directly below :    #
#                                                                         #
#                    TD DIV.tclcon {MARGIN-LEFT: 2.3em}                                    #
#                                                                        #
#-----------------------------------------------------------------------------------------------------------#


#
#---------[ 37. SAVE & UPLOAD ]-------------------------------------------------
#

I made some thing show up in front of the topic title in punbb-1.2.23.I will try it on punbb-1.4RC2.