Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 Programming Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 06-06-2002, 10:23 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default 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?
Reply With Quote
  #2  
Old 06-07-2002, 08:00 AM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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])) {
with:

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])) {
and in /root/attachment.php, I replaced:

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');
}
with:

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');
}
I know the second part of the code is for viewing bmps online, but I'm not sure what the first part does. It has to do with the attachment editor in some way, but I'm not quite sure what yet.

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.
Reply With Quote
  #3  
Old 06-07-2002, 12:52 PM
Admin's Avatar
Admin Admin is offline
Coder
 
Join Date: Oct 2023
Location: Server
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #4  
Old 06-07-2002, 12:59 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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:
Originally posted by FireFly
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.
Reply With Quote
  #5  
Old 06-07-2002, 01:22 PM
Admin's Avatar
Admin Admin is offline
Coder
 
Join Date: Oct 2023
Location: Server
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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
Reply With Quote
  #6  
Old 06-07-2002, 01:37 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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:
Originally posted by FireFly
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
Reply With Quote
  #7  
Old 06-07-2002, 09:32 PM
N!ck N!ck is offline
 
Join Date: Mar 2002
Location: Lake Havasu City, AZ
Posts: 886
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

yeah, that wasn't me
Reply With Quote
  #8  
Old 06-07-2002, 09:42 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yeah, I kindof figured that. I know most of your hacks and I didn't remember seeing that one by you.

Quote:
Originally posted by nicksaunders
yeah, that wasn't me
Reply With Quote
  #9  
Old 06-08-2002, 12:19 PM
Boofo's Avatar
Boofo Boofo is offline
 
Join Date: Mar 2002
Location: Des Moines, IA (USA)
Posts: 15,776
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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:
Originally posted by FireFly
The second part is when you link directly to a BMP attachment, it will show it instantly without having to download it first.
Reply With Quote
  #10  
Old 06-08-2002, 02:44 PM
Admin's Avatar
Admin Admin is offline
Coder
 
Join Date: Oct 2023
Location: Server
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 10:46 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04694 seconds
  • Memory Usage 2,263KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (4)bbcode_code
  • (4)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (10)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete