Previous Thread
Next Thread
Print Thread
Rate Thread
#222779 08/23/2002 12:07 AM
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Mod Name / Version - AttachFileTypeImage1.0.txt

Created - August 23, 2002

Description - Adds a File Attachment Icon to the Postlist, Show Flat and Threaded View indicating the TYPE of File that is attached. With the new download script.. you don't know what you are clicking on... a small photo... a large video file... a text file... a pdf, a File Attachment Icon will indicate what type of file is attached. In the Postlist view, the icon appears in front of the subject (in place of the standard disk). In Flat and Threaded views, it will appear next to the "Attachment" link, which also helps users find the small "attachment" link. You can edit the file types if you need to add an extension. If the file type isn't in the code, it will default to the disk icon.

Working Under - UBB.threads 6.1

Any pre-requisites - none

Author(s) - Joshua Pettit (JoshPet)

Credits - many have suggested it at ThreadsDev - I think Gardener recently suggested this more specifically

Files Altered - postlist.php, showflat.php, showthreaded.php

Database Altered - no

New Files - fileiconmovie.gif, fileiconpdf.gif, fileiconphoto.gif, fileiconsound.gif, fileicontext.gif, fileiconzip.gif

Any other info - This mod is all set, but my graphics are still lacking.

[:"red"]PLEASE POST SOME BETTER FILE ICONS IF YOU FIND THEM!!![/]

Current included icons are:
[]http://www.pettitfamily.net/josh/fileiconphoto.gif[/] for .GIF, .JPG, .PNG graphic files.

[]http://www.pettitfamily.net/josh/fileiconsound.gif[/] for .WAV, .RA, .AU, .MP3, .AVI sound files.

[]http://www.pettitfamily.net/josh/fileiconmovie.gif[/] for .MPG, .MPEG, .RM, .WMV, .MOV, .ASX, .RAM video files.

[]http://www.pettitfamily.net/josh/fileicontext.gif[/] for .TXT text files.

[]http://www.pettitfamily.net/josh/fileiconzip.gif[/] for .ZIP, .SIT, .SEA compressed files.

[]http://www.pettitfamily.net/josh/fileiconpdf.gif[/] for .PDF Adope Acrobat files.

If the file type isn't specified in the code... it will default to the standard disk icon []https://www.ubbdev.com/threads/php/images/icons/disk.gif[/].

Like I said.... I don't really like the icons.... it's all I could find. Suggestions please. Also let me know if I've left out or mis categorized any file type extension.

Thanks!
Attachments
54633-AttachFileTypeImage1.0.zip (0 Bytes, 21 downloads)

Sponsored Links
Joined: May 1999
Posts: 1,715
Addict
Addict
Joined: May 1999
Posts: 1,715
Nice work! I've wanted this before, and as you say it is even more needed in 6.1.

How about also adding the size of the attachment next to the link on showflat and showthreaded?

I'll try to find some better icons, they should all be roughly the same size and style for it to look good.

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Thank you!
Filesize would be a good idea. I'll have to look at that in a revision.
We have a video forum on our site.. and some of those attachments can get large for the poor folks using dial up .


Joined: Oct 2001
Posts: 157
Member
Member
Offline
Joined: Oct 2001
Posts: 157
Josh, will this work in 6.0.1 ? I needed this desperately, but want to give 6.1 a bit of time to settle down before I upgrade


Yors Truly

Who? Me? Worry?
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
It could..... there will be slight changes. (because of the new download script in 6.1)

I will look at this and post instructions for 6.x tonight.

Sponsored Links
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Version 1.1 is attached to THIS POST.

It's the same.... is't just at the bottom of the instructions I give directions for 6.0.x.

Enjoy!

Attachments
54651-AttachFileTypeImage1.1.zip (0 Bytes, 5 downloads)

Joined: Oct 2001
Posts: 157
Member
Member
Offline
Joined: Oct 2001
Posts: 157
Thanks a ton, I am trying this out NOW!

Just bothering you with another question, or rather suggestion. From the description, it seems this iwll work only for attachments. But in my board, though I have the hack installed which displays attached pictures inline in the post, most of my members tend to post pictures using the [image] code -- in your future release, if you could incorporate displaying the gif in postlist even for [image] tagged pics inside a post, that will be gr8!


Yors Truly

Who? Me? Worry?
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Good suggestion.

I'll have to see if that's doable.
I don't think the postlist looks up the body of the message... although it could....
That also might be a first step at a mousover preview of the message.

Hmmmmmmm....

Joined: Oct 2001
Posts: 157
Member
Member
Offline
Joined: Oct 2001
Posts: 157
Josh, had some problems (v.6.0.1)...

1) showflat -- works fine.

2) showthreaded -- doesnt show the icon beside Attachment -- in fact, doesnt even show th eword "Attachment" any more.

3) Postlist -- absolutely no effect -- it just doesnt show any icons.

Where might I have gone wrong? I do have a hack installed which inlines all attachments and displays the image, but in showflat, both of them works together and is working fine.

Personally, I can live without the icon showing up beside "Attachment" text -- we only allow image attachments, and they are inlined anyway. But the postlist is what I desperately wanted to work.




Yors Truly

Who? Me? Worry?
Joined: Oct 2001
Posts: 157
Member
Member
Offline
Joined: Oct 2001
Posts: 157
Ok, managed to sort out (2) above. Showthread now works.

In the last but one line were the text for 6.0.1 says "replace with"
code:
$postrow[$i]['filelink'] = "<a href="{$config['fileurl']}/$File">{$ubbt_lang['FILE_ATTACH']} $fileicon</a>";



Should actually be
code:
$filelink = "<a href="{$config['fileurl']}/$File">{$ubbt_lang['FILE_ATTACH']} $fileicon</a>";



That took care of it. Work sfine now.

(3) This still aint working -- I rehacked thrice

If its any clue, I have installed the Sticky hack, and though I can Stick posts, it does not display the word "Sticky:" in front of the Subject like the code says it should. I have checked the code and found nothing wrong.

If you take the two incidences together, then in my board something is stopping anything to be displayed in front of the $subject! Any clues?



Yors Truly

Who? Me? Worry?
Sponsored Links
Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
How come when I take a look at your hack instructions none of the lines you say are in the files are actually in the files?

They do not exist in version 6.1 of files. Is this hack an add-on of another hack I need to do?

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
posted by crescendo:
Josh, had some problems (v.6.0.1)...
3) Postlist -- absolutely no effect -- it just doesnt show any icons.



Sounds like you figured out all the problems except Postlist.

I revised the postlist instructions (for 6.0.x) and will repost below... as version 1.2.

In 6.1 Rick is already checking the database to see if there's a file.. as he does the disk icon thing... but not in 6.0.x.... so we need to add that in.

Download 1.2 and note the 2 new lines to change (Adding $file to the database query) in postlist.php and you should be all set.

Sorry.... didn't test for 6.0.x and have begun to lose track of what were features and what were hacks.

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Version 1.2 is Attached!

It fixes directions for postlist.php on version 6.0.x

Directions for 6.1 remain unchanged.

:)
Attachments
54743-AttachFileTypeImage1.2.zip (0 Bytes, 6 downloads)

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
posted by omegatron:
How come when I take a look at your hack instructions none of the lines you say are in the files are actually in the files?

They do not exist in version 6.1 of files. Is this hack an add-on of another hack I need to do?


I just looked at your site.... you're running 6.0.3.

The instructions at the begining of the hack are for the newly created.... 6.1 BR1...came out just a couple of days ago.

If you need instructions for 6.0.1, 6.0.2, and 6.0.3... the instructions come AFTER the 6.1 instructions (as I added them for crescendo). Read past the 6.1 instructions if you're not running 6.1 BR1 yet.

Joined: Oct 2001
Posts: 157
Member
Member
Offline
Joined: Oct 2001
Posts: 157
posted by JoshPet:
Version 1.2 is Attached!


Whooooohooo...I got it working finally (6.0.1) -- bless you Josh!!

OK, there was still a 'wee bit' of crease in the text of v1.2 -- confusion between $File and $file (yes, just uppercasing all Fs wherever there is "$file" solved the problem with postlist!!)

I am taking the privilege of uploading the corrected instruction -- please note that this is entirely Joshpets creation, I have merely corrected some minor errors in the UBBT6.0.x instructions
Attachments
54760-AttachFileTypeImage1.2.txt (0 Bytes, 39 downloads)


Yors Truly

Who? Me? Worry?
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Cool. Thank you!

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
OK

I've added the ability for it to display in showflat and showthreaded the size of the Attachment in Bytes, KB or MB (whichever is the most logical). Thus users can not initiate the download of a large attachment if they have a slow connection.

Version 1.3 is Attached to THIS POST
Attachments
54772-AttachFileTypeImage1.3.zip (0 Bytes, 6 downloads)

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
posted by crescendo:
Just bothering you with another question, or rather suggestion. From the description, it seems this iwll work only for attachments. But in my board, though I have the hack installed which displays attached pictures inline in the post, most of my members tend to post pictures using the [image] code -- in your future release, if you could incorporate displaying the gif in postlist even for [image] tagged pics inside a post, that will be gr8!


Just re-read this thread and was reminded of this request... I think this has merit too, to allow for inline photos.

I'm not sure if it's do-able (at my level)... I'm new to this but learning fast... but I surprised myself today in figuring out the filesize thing..... so I will look and see if i can make this work.

I think mod has some great potential...I am especially liking the addition of the filesize.... you should be able to see what lines were new in the instructions if you wish to add that in.

If anyone finds some better images (or feels creative) that would better fit with the size and theme of threads....please post them.

Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
Well it is actually very doable. I have both hacks installed together fine. Here is the code below. You will see I did not delete the initial hacks code so the pics are still displayed inline.

Josh's hack in red the inline image in blue.

[:"red"]
if ($File) {
$fileicon = "";
if (eregi("\.GIF|\.JPG|\.PNG", $File)) {
$fileicon = "<img src="{$config['images']}/fileiconphoto.gif" alt="Photo" border="0" $imagestyle />";
}
elseif (eregi("\.TXT", $File)) {
$fileicon = "<img src="{$config['images']}/fileicontext.gif" alt="Text Document" border="0" $imagestyle />";
}
elseif (eregi("\.ZIP|\.SIT|\.SEA", $File)) {
$fileicon = "<img src="{$config['images']}/fileiconzip.gif" alt="Compressed File" border="0" $imagestyle />";
}
elseif (eregi("\.PDF", $File)) {
$fileicon = "<img src="{$config['images']}/fileiconpdf.gif" alt="PDF File" border="0" $imagestyle />";
}
elseif (eregi("\.WAV|\.RA|\.AU|\.MP3|\.AVI", $File)) {
$fileicon = "<img src="{$config['images']}/fileiconsound.gif" alt="Sound File" border="0" $imagestyle />";
}
elseif (eregi("\.MPG|\.MPEG|\.RM|\.WMV|\.MOV|\.ASX|\.RAM", $File)) {
$fileicon = "<img src="{$config['images']}/fileiconmovie.gif" alt="Movie File" border="0" $imagestyle />";
}
else {
$fileicon = "<img src="{$config['images']}/file.gif" alt="{$ubbt_lang['FILE_ATTACH']}" border="0" $imagestyle />";
}
$File = rawurlencode($File);
$postrow[$i]['filelink'] = "<a href="{$config['fileurl']}/$File">{$ubbt_lang['FILE_ATTACH']} $fileicon</a>";[/][:"blue"]
if ($user['U_Username']) {
if (eregi("\.GIF|\.JPG|\.PNG", $File)) {
$TempBod = $Body;
$TempBod .= "<br /><br /><IMG SRC="$config[fileurl]/$File" Border="0">";
$Body = $TempBod;
}
}
}
[/]


Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Yes, cool.

He wants the "photo" icon to appear if someone has used the image tag in their post and linked to an off site photo in their post as well.

I need to look at that. It's probably doable as well.

Thanks.

Joined: Oct 2001
Posts: 157
Member
Member
Offline
Joined: Oct 2001
Posts: 157
Thats right Josh. Omegatron: this hack works perfectly with inlined "Attached" images, as you say...even I have both installed and working together. All you have to do is correctly identify where to replace or insert the codes keeping the inlining code intact. I was specifically looking for this to work with [image] tagged pictures too.

Just stating so that there is no confusion


Yors Truly

Who? Me? Worry?
Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
okay yes thats cool. Thats always a good thing to pay proper attention to hacking and merging

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Version 1.4 is attached to this post.

It offers 2 alternative icons for Zip and Movie files.

It fixes a bug in the filesize calculation that wasn't working correctly if the file name had spaces or special characters. Thanks to Dave_L for helping me with this.

It fixes a bug where .RAM files (video) were showing as a sound file because .RA came first in my list.

Enjoy!
Seems to be working well on my 6.1 br1 board which has now gone live.
Attachments
56169-AttachFileTypeImage1.4.zip (0 Bytes, 16 downloads)

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
[]most of my members tend to post pictures using the [image] code -- in your future release, if you could incorporate displaying the gif in postlist even for [image] tagged pics inside a post, that will be gr8!


I haven't forgotten this..... but I don't think it's possible.

The post is stored with the <img src tag in the database. If you were to say "if the body contains img src tag...then display the photo image in the subject... it would do so for graemlins as well.

Don't know of a way around that. They are images too.

If I had a photo icon in each post when graemlins were used.... every post would have one.. and it would be worthless. <SHRUG>

Joined: May 1999
Posts: 1,715
Addict
Addict
Joined: May 1999
Posts: 1,715
One way could be to add a field in the table which can be 1 or 0 and is set when the post is made. If there is an image-tag in the post, the value of the field is set to 1. Then you would only have to check this variable in the postlist.

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
That's a good idea... you could look for the "image" tag when the post is made.

Joined: Jun 2002
Posts: 375
Enthusiast
Enthusiast
Offline
Joined: Jun 2002
Posts: 375
Or you could add the html of each graemlin on your site into the code, to ignore them. This way would not alter the database at least.

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
I wonder. Either way...this one might be about 3 feet over my head.

Joined: Jun 2002
Posts: 375
Enthusiast
Enthusiast
Offline
Joined: Jun 2002
Posts: 375
I'm kinda bored, might start farting around with this one. I would do it with no database alterations though. More code to add in, but less intrusive if you remove it later on.

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
I agree. I use database alterations sparingly.

I've been debating about the "last post" hack for months. Might give that one a go.

Joined: Jun 2002
Posts: 375
Enthusiast
Enthusiast
Offline
Joined: Jun 2002
Posts: 375
I got this working, but it's only searching the first post for the <img> tag so far. I need to have it ignore graemlins and see if I can get it to look at the other post bodies as well. May just let it look at the first, since that seems more doable and far less strain on the server.

Joined: Jun 2002
Posts: 375
Enthusiast
Enthusiast
Offline
Joined: Jun 2002
Posts: 375
I just finished a hack to show an image in the supject on the postlist.php page for posts that have an image inserted in the body on the initial post. It is located here.

It just seemed like too much server load to have it hunt down every reply and search through them...

Joined: Oct 2001
Posts: 157
Member
Member
Offline
Joined: Oct 2001
Posts: 157
[]

The post is stored with the <img src tag in the database. If you were to say "if the body contains img src tag...then display the photo image in the subject... it would do so for graemlins as well.

Don't know of a way around that. They are images too.



Josh, thee graemlins are stored in a specific directory, isnt it? Cant we make the script ignore any img src tag pointing to that directory?

I mean, when I thought of this, I too was exactly foxed by "what to do with graemlins?", but this seems to be the simplest way, if its possible.


Yors Truly

Who? Me? Worry?
Joined: Oct 2001
Posts: 157
Member
Member
Offline
Joined: Oct 2001
Posts: 157
oops, sorry, I was on page 2 when I replied

Going over to check your hack aglavalin!


Yors Truly

Who? Me? Worry?

Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
JAISP
JAISP
PA
Posts: 449
Joined: February 2008
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20221218)