Thread Rating:
  • 3 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Thread Image
RateU Offline
Administrator
*******
Posts: 2,350
Joined: Mar 2010
Post: #1
Thread Image
Requirement: XThreads
Just for XThreads users who want to achieve this with XThreads.

File field type for Image Upload.
Create a new custom thread fields with this settings:
  • Title : Thread Image
  • Key : timg
  • Description: Max file size: 10 KB. Max image size: 200x200. Min Image Size: 75x75. Image allowed: GIF, JPEG, PNG.
    Modify it as our needs. Depends on some settings bellow.
  • Applicable Forums : Select forum(s) where this will be applied
  • Input Field Type : File
  • Valid File Extensions : gif|png|jpeg|jpg
  • Maximum File Size : 1280
    Modify it as our needs. This is the maximum file size for image can be uploaded. ( in bytes). Related to the Description setting.
  • Editable by / Required Field? : Select which usergroup can use this feature. If more than one usergroups allowed to use this feature, but not for all usergroups, select Custom (specify usergroup). This will bring the additional setting:
    • Editable by Usergroups : Select which usergroup can use this feature
  • Only Accept Image Files : Yes
  • Minimum Image Dimensions : 75x75
    Modify it as our needs. It is the smallest image dimension can be uploaded. Related to the Description setting.
  • Maximum Image Dimensions : 200x200
    Modify it as our needs. It is the largest image dimension can be uploaded. Related to the Description setting.
  • Image Thumbnail Generation : 75x75
    Modify it as our needs. It is the thumbnail size that will be displayed in threadlist. Related to Display Format setting bellow.
  • Display Format :

    HTML Code
    <a href="{URL}" target="_blank"><img src="{URL}/thumb75x75" alt="{FILENAME}" title="Click to view this thread image in full size - {$GLOBALS['threadfields']['timg']['dims']['w']} x {$GLOBALS['threadfields']['timg']['dims']['h']}" style="margin: 3px; float: left;" /></a>

    If we modify the Image Thumbnail Generation setting with different thumbnail size, change this part of the code above:

    Code:
    75x75


It should be enough as a basic settings. If we want to enhance it a bit, try to play with the Blank Replacement Value, Viewable by Usergroups and Unviewable Value settings.

Now, open up our forumdisplay_thread template. Find:
1.4:

HTML Code
<span>{$prefix} {$gotounread}<a href="{$thread['threadlink']}" class="{$inline_edit_class} {$new_class}" id="tid_{$inline_edit_tid}">{$thread['subject']}</a>{$thread['multipage']}</span>


1.6:

HTML Code
<span>{$prefix} {$gotounread}{$thread['threadprefix']}<a href="{$thread['threadlink']}" class="{$inline_edit_class} {$new_class}" id="tid_{$inline_edit_tid}">{$thread['subject']}</a>{$thread['multipage']}</span>


Add this variable at the beginning of the code above:

Code:
{$GLOBALS['threadfields']['timg']['value']}


That template edit should be enough as a basic. If we want to enhance it a bit, try to play more with the forumdisplay_thread template, and maybe (additional) forumdisplay_threadlist template, and combine it with our custom thread fields settings.



Attached File(s) Thumbnail(s)
   

(This post was last modified: 02-13-2011 03:16 AM by RateU.)
10-24-2010 06:18 AM
Find all posts by this user Quote this message in a reply
Flabaliki Offline
Junior Member
**
Posts: 16
Joined: Jul 2010
Post: #2
RE: Thread Image
This is great, I've been using my own version of this for a long time Tongue
http://thesimsupply.com/forumdisplay.php?fid=92

It's really great for a downloads forum Smile

http://youtube.com/Flabaliki
10-24-2010 11:00 AM
Visit this user's website Find all posts by this user Quote this message in a reply
1master1 Offline
Member
***
Posts: 232
Joined: Oct 2010
Post: #3
RE: Thread Image
RateU, i love you man. I simply love zingaburga site. Smile)
10-25-2010 12:26 PM
Find all posts by this user Quote this message in a reply
1master1 Offline
Member
***
Posts: 232
Joined: Oct 2010
Post: #4
RE: Thread Image
giving this error, though we attach the specified file types.

Please correct the following errors before continuing:

    * Error attaching file for "Thread Image"; The type of file that you attached is not allowed. Please remove the attachment or choose a different type.
i tried it disabling "only image" option and it accepted, but showed as a link and i dont think disabling this "only image" option is good.
(This post was last modified: 10-25-2010 02:02 PM by 1master1.)
10-25-2010 01:37 PM
Find all posts by this user Quote this message in a reply
ZiNgA BuRgA Online
Fag
*******
Posts: 3,357
Joined: Jan 2008
Post: #5
RE: Thread Image
Well it tells you the issue.  You're not giving it what it considers to be a valid image.

My Blog
10-25-2010 04:07 PM
Find all posts by this user Quote this message in a reply
1master1 Offline
Member
***
Posts: 232
Joined: Oct 2010
Post: #6
RE: Thread Image
What do you mean by that? Doesnt it allow the png files though it specifies pngs are allowed??
10-26-2010 02:52 AM
Find all posts by this user Quote this message in a reply
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #7
RE: Thread Image
Invalid image can mean file type or file size or dimensions, so if the settings for an image upload is a png and 190 kb measuring 100*200 and you upload a 185kb png with dimensions 200*200 then it will be an invalid image because it failed the dimensions check.

Check all the attributes Smile


[Image: leelink.gif]
MYBB1.6 & XThreads
(This post was last modified: 10-26-2010 03:13 AM by leefish.)
10-26-2010 03:13 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Skatman Offline
Junior Member
**
Posts: 18
Joined: Apr 2011
Post: #8
RE: Thread Image
How can I make this image appear in the post icon zone?
04-23-2011 04:49 AM
Find all posts by this user Quote this message in a reply
RateU Offline
Administrator
*******
Posts: 2,350
Joined: Mar 2010
Post: #9
RE: Thread Image
In your forumdisplay_thread template, find:

Code:
{$icon}


Replace it with:

Code:
{$GLOBALS['threadfields']['timg']['value']}


04-23-2011 05:15 AM
Find all posts by this user Quote this message in a reply
Skatman Offline
Junior Member
**
Posts: 18
Joined: Apr 2011
Post: #10
RE: Thread Image
Okay, it works fine, thanks for your time !
04-23-2011 05:19 AM
Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

 Standard Tools
Forum Jump: