Go Back   vb.org Archive > Community Discussions > Modification Requests/Questions (Unpaid)
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 10-18-2002, 02:33 PM
Sebastian's Avatar
Sebastian Sebastian is offline
 
Join Date: Oct 2002
Location: America
Posts: 488
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Attachments Hack

I apologize if a hack already exists:

1) I would like to center images on the post when a screenie gets uploaded, instead of it aligning to the left margin.

2) Be able to upload more than one image/attachment on a post.

3) Finally, When an image is uploaded have it resize to lets say 800x600 and if it was originally bigger make the image click-able so you can see the full image. That way big images can get uploaded without destroying the margins and making a thread look like crap.

Any of these options available, if not how hard will it be?

Thanks in advanced.
Reply With Quote
  #2  
Old 10-18-2002, 02:57 PM
Tim Wheatley's Avatar
Tim Wheatley Tim Wheatley is offline
 
Join Date: Nov 2001
Location: England
Posts: 489
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

1 and 3 I can sort for you, just a sec...
Reply With Quote
  #3  
Old 10-18-2002, 03:02 PM
Tim Wheatley's Avatar
Tim Wheatley Tim Wheatley is offline
 
Join Date: Nov 2001
Location: England
Posts: 489
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Edit template: postbit_attachmentimage

Replace entire contents with:

Code:
<smallfont>$post[username] has attached this image:<p>
<center><a href="attachment.php?s=$session[sessionhash]&postid=$post[postid]"><img width="800" src="attachment.php?s=$session[sessionhash]&postid=$post[postid]" border="0" alt="Click to open the image in a new window" vspace="8" hspace="4"></smallfont></center></p>
Screenshot: (the mouse pointer is invisible on the screenie, but it was just next to the text in the yellow box)...
Attached Images
File Type: gif centeredimageopennewwindow.gif (128.7 KB, 0 views)
Reply With Quote
  #4  
Old 10-18-2002, 06:24 PM
Sebastian's Avatar
Sebastian Sebastian is offline
 
Join Date: Oct 2002
Location: America
Posts: 488
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks a lot dude! Going to try it now

How hard will it be to make it possible to upload more than one image per post? I really would like that. Perhaps dublicate the attachment code or something? :P

Thanks again.
Reply With Quote
  #5  
Old 10-18-2002, 06:35 PM
Tim Wheatley's Avatar
Tim Wheatley Tim Wheatley is offline
 
Join Date: Nov 2001
Location: England
Posts: 489
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Something I've just thought of on my code above. If someone upload a SMALL image, it stretches it to 800. So if you want to remove the 800 width bit just remove:
Code:
width="800"
I'm not really very good with PHP, HTML is more my field, so someone else would have to help with multi-uploads.
Reply With Quote
  #6  
Old 10-18-2002, 07:31 PM
Sebastian's Avatar
Sebastian Sebastian is offline
 
Join Date: Oct 2002
Location: America
Posts: 488
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

aww.. is there a way not to resize the image if it's smaller than 800x600?

I really, really want this bad :P
It makes the threads look so much cleaner.

Thanks again.
Reply With Quote
  #7  
Old 10-22-2002, 01:42 PM
Sebastian's Avatar
Sebastian Sebastian is offline
 
Join Date: Oct 2002
Location: America
Posts: 488
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Can anyone get this code not to resize an image if it's smaller than the size specified? This works awesome, in keeping threads clean :P
Reply With Quote
  #8  
Old 10-23-2002, 10:12 AM
Tim Wheatley's Avatar
Tim Wheatley Tim Wheatley is offline
 
Join Date: Nov 2001
Location: England
Posts: 489
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Well it will be within attachment.php, and would be easier done on file size I'd expect, with the > sign... But I can't help much...
Reply With Quote
  #9  
Old 10-24-2002, 10:35 AM
Logician's Avatar
Logician Logician is offline
 
Join Date: Nov 2001
Location: inside vb code
Posts: 4,449
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Tim's solution is wise and it forces the image to resize with HTML. But it is inevitable that all images will be forced to be in that size if you use HTML.

To make some (largers) resize and others (smalls) stay as it is you need to handle the job in PHP, not in HTML and to handle it your code needs to know what is the image size so that it can take actions accordingly.

Unfortunately I cant see an easy way to manage your goal in PHP. AFAIK the image size of the attachment is not saved in the attachment table so its not possible to know the dimensions of the image by checking your db. There is a special function "getimagesize" in PHP which would be a remedy for your problem but its not a default PHP function but a part of an additional image library. In other words so as to use this function (and to get the image size) your PHP should be equipped with image library by installing it. It's a server side library so your host must be installing it and for the same reason even if the solution is provided, it will not work for all users since many hosts wouldnt include this library in their PHP configuration.

As for multi-attachments hack: It's a long waited hack but not released here. Neo says he is working on it for a long time but if you make a list of hacks Neo says he is working on, you can really doubt if he can finish any of this very long list soon. I also know there is commercial version of this hack coded by someone and sold commercially. But I dont know his name..
Reply With Quote
  #10  
Old 10-24-2002, 02:29 PM
Sebastian's Avatar
Sebastian Sebastian is offline
 
Join Date: Oct 2002
Location: America
Posts: 488
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks for the reply. I know it never can be done using .html, I haven't been using vb that long to know what files need to be edited, etc.. I didn't think this would be this complicated as I know a forum that has this feature implemented, though I think it's some sort of perl forums. maybe down the road as I get more familiar with vb I can do it myself. In the mean time I am sure a vb guru can knock this out in 10 minutes.

As for the attachment, I don't care for it as much, It would be useful.. I am hearing it's probably going to be added to vb3.

Thanks for the help.
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:17 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04604 seconds
  • Memory Usage 2,276KB
  • Queries Executed 12 (?)
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
  • (2)bbcode_code
  • (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
  • (1)postbit_attachment
  • (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
  • postbit_attachment
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete