vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Graveyard (https://vborg.vbsupport.ru/forumdisplay.php?f=224)
-   -   Board Optimization - Replace large images in posts with links to the images (https://vborg.vbsupport.ru/showthread.php?t=99776)

buro9 11-01-2005 04:45 AM

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.

NuclioN 11-01-2005 05:09 AM

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.

buro9 11-01-2005 05:18 AM

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.

buro9 11-01-2005 05:19 AM

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.

buro9 11-01-2005 05:24 AM

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 :D

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.

Aeolian_X 11-01-2005 05:39 AM

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.

NuclioN 11-01-2005 06:20 AM

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

buro9 11-01-2005 06:54 AM

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 :)

buro9 11-01-2005 07:45 AM

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.

NuclioN 11-01-2005 08:17 AM

<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.


All times are GMT. The time now is 09:42 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.01240 seconds
  • Memory Usage 1,740KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (3)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete