The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
BMP Images
I want to have it so I can view BMP images just like gifs when they are an attachment. I have added it in one place in the functions.php already, do I need to add it anywhere else? (Like for private attachments?) Also, how can I put commas between the file types in the attachment box? And will adding the different file types in the admin CP allow them to be able to be attached or is there something else I must do?
|
#2
|
||||
|
||||
Here's the code I added to view bmps. In admin/functions.php, I replaced this:
Code:
if ($post[attachmentid]!=0 and $post[attachmentvisible]) { $post[attachmentextension]=strtolower(getextension($post[filename])); if ($post[attachmentextension]=="gif" or $post[attachmentextension]=="jpg" or $post[attachmentextension]=="jpeg" or $post[attachmentextension]=="jpe" or $post[attachmentextension]=="png") { if (($viewattachedimages) and ($bbuserinfo[userid]==0 or $bbuserinfo[showimages])) { Code:
if ($post[attachmentid]!=0 and $post[attachmentvisible]) { $post[attachmentextension]=strtolower(getextension($post[filename])); if ($post[attachmentextension]=="gif" or $post[attachmentextension]=="jpg" or $post[attachmentextension]=="jpeg" or $post[attachmentextension]=="jpe" or $post[attachmentextension]=="png" or $post[attachmentextension]=="bmp") { if (($viewattachedimages) and ($bbuserinfo[userid]==0 or $bbuserinfo[showimages])) { Code:
if ($extension=='gif') { header('Content-type: image/gif'); } elseif ($extension=='jpg' or $extension=='jpeg') { header('Content-type: image/pjpeg'); } elseif ($extension=='png') { header('Content-type: image/png'); } elseif ($extension=='pdf') { header('Content-type: application/pdf'); } else { header('Content-type: unknown/unknown'); } Code:
if ($extension=='gif') { header('Content-type: image/gif'); } elseif ($extension=='jpg' or $extension=='jpeg') { header('Content-type: image/pjpeg'); } elseif ($extension=='png') { header('Content-type: image/png'); } elseif ($extension=='bmp') { header('Content-type: image/bmp'); } elseif ($extension=='pdf') { header('Content-type: application/pdf'); } else { header('Content-type: unknown/unknown'); } What I need to know is, do I need to add this anyplace else (like for the private attachments) or will this handle that also? And is there any way to come up with the filesize in the post next to an attachment so the user can decide if they want to wait to view it? I mean, if the filesize is too big and they are on dialup, it might be good to know the size of the file so they can decide if they want to wait for it to download to view. Also, is there a way to add something like a box as the graphic file is downloading for viewing to let the user know how long it will take? Almost like the downloading box. If anyone can please help me, I would really appreciate it. |
#3
|
||||
|
||||
The first change shows the attachment as an image, if it's of BMP format.
A hack was released to only show images smaller than X kb's, search the Releases, AFAIK it was by nicksaunder. |
#4
|
||||
|
||||
Thanks for the reply. Ok, I understand the first part now, but what does the second part do then? Do I need both parts to view a bmp file then? And do I need to put the code for bmps anywhere else?
And what I was really looking for is maybe after the word "Attachment", have it say what the size of the file is in the message itself. Quote:
|
#5
|
||||
|
||||
The second part is when you link directly to a BMP attachment, it will show it instantly without having to download it first.
Hack: https://vborg.vbsupport.ru/showthrea...chment+%2Asize |
#6
|
||||
|
||||
Ahhh...I see now. But if the bmp is large enough (like 1.5 meg), then it still has to cache to the browser first before it can show, right? (Which would still take some time on a slow connection).
Great! Thanks! And thanks for the link. I just got finished looking for it and couldn't find it. Quote:
|
#7
|
|||
|
|||
yeah, that wasn't me
|
#8
|
||||
|
||||
Yeah, I kindof figured that. I know most of your hacks and I didn't remember seeing that one by you.
Quote:
|
#9
|
||||
|
||||
I just noticed that if I try to view a bmp (or whatever), it says it is downloading the post (in the status bar at the bottom of IE) before it goes to view it. That's just downloading it to the cache, I suppose. But shouldn't that second part of the code take care of that? I guess I'm a little confused here.
Quote:
|
#10
|
||||
|
||||
You always download files (BMP or not) before you can view them, it's the nature of the internet.
The only difference is, the second change you made enabled you to view the image directly in Internet Explorer (or whatever browser you are using), instead of having that window pop up and ask you to save the file. |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|