Go Back   vb.org Archive > vBulletin Modifications > Archive > Modification Graveyard

Reply
 
Thread Tools
Replace large images in posts with links to the images Details »»
Replace large images in posts with links to the images
Version: 1.2, by buro9 buro9 is offline
Developer Last Online: Jul 2012 Show Printable Version Email this Page

Category: Board Optimization - Version: 3.5.2 Rating:
Released: 10-30-2005 Last Update: 10-31-2005 Installs: 13
Code Changes Additional Files  
No support by the author.

No longer supported by the author.

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #12  
Old 11-01-2005, 04:45 AM
buro9 buro9 is offline
 
Join Date: Feb 2002
Location: London, UK
Posts: 585
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Screenshots for those who need such things now attached.

I've used this image as an example:
http://miam-miam.viabloga.com/images...ufs%20durs.jpg

Because it's 1024 pixels wide, it gets replaced by a link after the first view.
Reply With Quote
  #13  
Old 11-01-2005, 05:09 AM
NuclioN's Avatar
NuclioN NuclioN is offline
 
Join Date: Aug 2002
Posts: 955
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Would be great if it does what promiced I've editted an already placed oversized image that whas reduced with the 3.xx BIMG tags but it did not turn into a link. Maybe it will only work with new posted images.
Reply With Quote
  #14  
Old 11-01-2005, 05:18 AM
buro9 buro9 is offline
 
Join Date: Feb 2002
Location: London, UK
Posts: 585
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by NuclioN
Would be great if it does what promiced I've editted an already placed oversized image that whas reduced with the 3.xx BIMG tags but it did not turn into a link. Maybe it will only work with new posted images.
It should work with all [img] tags providing that they are [img]url[/img] or [IMG]url[/IMG].

The only thing it won't work with is pure HTML. But no-one allows users to post HTML because of security risks, right?

Anyhow, so long as you have a DOM capable browser that supports XmlHttp and either element.parentElement (IE6) or element.parentNode (Mozilla and the others, this is the W3C implementation)... then it will call the script.

Oh, but if you have edited your templates from the vb default and nuked the following from the postbit templates, then you will prevent the hack from working:
Code:
<div id="post_message_$post[postid]">$post[message]</div>
That's where I get the postId from... by walking up the DOM back to that DIV.
Reply With Quote
  #15  
Old 11-01-2005, 05:19 AM
buro9 buro9 is offline
 
Join Date: Feb 2002
Location: London, UK
Posts: 585
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

And if you're sure it's not working, just say and I'll add some trace/debug stuff to it so that you can optionally see it working before you switch it to run silently.
Reply With Quote
  #16  
Old 11-01-2005, 05:24 AM
buro9 buro9 is offline
 
Join Date: Feb 2002
Location: London, UK
Posts: 585
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by NuclioN
Would be great if it does what promiced I've editted an already placed oversized image that whas reduced with the 3.xx BIMG tags but it did not turn into a link. Maybe it will only work with new posted images.
I think I read that wrong too.

With the hack installed you don't need to edit anything

You just view them.

Order of events:
  1. Registered user views a thread
  2. Thread contains large images in the post body
  3. Image gets detected by the JavaScript
  4. JavaScript SILENTLY calls the trimOversizedImages.php file
  5. The php file checks that the postId supplied is cool, and then converts the [img] bbcode to [url] bbcode
That user, still saw the image and wasn't even aware that he just caused the large image to be converted on the server. However the next refresh of that page goes like this:
  1. User views a thread
That's it Because the large image was converted to a link, so none of the above repeats itself.

So you don't need to edit anything. Just CTRL+F5 to ensure your browser has the latest version of vbulletin_global.js, and then view the thread. Once viewed, click CTRL+F5 again to refresh the page and the image should be gone.
Reply With Quote
  #17  
Old 11-01-2005, 05:39 AM
Aeolian_X Aeolian_X is offline
 
Join Date: Jun 2005
Posts: 45
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I had to refresh the page a few times to see the link without the pic. Not sure what that was, but it seems to work now. Great hack.
Reply With Quote
  #18  
Old 11-01-2005, 06:20 AM
NuclioN's Avatar
NuclioN NuclioN is offline
 
Join Date: Aug 2002
Posts: 955
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Refreshed several times, logged in and logged out etc. but the image stays large. I've looked into the js and the url to trimOversizedImages.php is correct. I'll check the
Code:
<div id="post_message_$post[postid]">$post[message]</div>
maybe that's the problem
Reply With Quote
  #19  
Old 11-01-2005, 06:54 AM
buro9 buro9 is offline
 
Join Date: Feb 2002
Location: London, UK
Posts: 585
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I'll add a debugging option for you... that way you can see what happens... via the wonder of JavaScript alerts

It will be off by default, but you can enable and disable debugging and if enabled it will give you popup messages from the web service saying what happened.

Give me 10 minutes for this
Reply With Quote
  #20  
Old 11-01-2005, 07:45 AM
buro9 buro9 is offline
 
Join Date: Feb 2002
Location: London, UK
Posts: 585
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I've added debugging capabilities, and updated the file to upload and the JavaScript to run.

Simply update by uploading the new .php file over the old one, and replace the JavaScript with the new version in the zip file.

Debugging will give you JavaScript alerts whenever it does stuff, so you will be able to 'see' things happening.
Reply With Quote
  #21  
Old 11-01-2005, 08:17 AM
NuclioN's Avatar
NuclioN NuclioN is offline
 
Join Date: Aug 2002
Posts: 955
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

<a href="http://www.cyberty.nl/forums/showthread.php?t=8987" target="_blank">http://www.cyberty.nl/forums/showthread.php?t=8987</a> look at the size (should be 500 - 500 when conversion to link must work) ... it shows no alert, no reducing.
Reply With Quote
Reply

Thread Tools

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 03:57 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.04226 seconds
  • Memory Usage 2,303KB
  • Queries Executed 25 (?)
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
  • (2)bbcode_code
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)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