vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.6 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=194)
-   -   Show Thread Enhancements - Dynamic Picture Resize for [IMG] tag (https://vborg.vbsupport.ru/showthread.php?t=157228)

thincom2000 09-08-2007 03:00 PM

Quote:

Originally Posted by TECK (Post 1334537)
You are person no. 2 who requested the above feature. :)
Keep in mind this: There is no way (for now) to separate the [IMG] bbcode from actual postbit and signature. In other words, if you have a message because the image is resized, this message will show anywhere, including the signature, which will make users upset.

I will definitely not edit the code in several vBulletin files, just to avoid this feature in the signature... so be aware what you ask for. :)

Actually, there is a way. When $bbcode->parse() is called, the parser checks whether we are in the calendar, a pm, signature, etc (stored in $forumid). Directly afterwards the bbcode_parse_start hook is called, which you can in turn use to store this info in a way that can be passed to your function.

Also, check out $bbcode->do_parse() and the other subsequently called functions, because it is entirely possible to accomplish this mod without using any file edits (which I'm sure everyone would like). I'll install it such on my site and post the code when I am done.

xandizitxu 09-08-2007 03:34 PM

Got it to work sorry! Forgot just to set the vBulletin Options!


Quote:

Originally Posted by thincom2000 (Post 1334880)
Actually, there is a way. When $bbcode->parse() is called, the parser checks whether we are in the calendar, a pm, signature, etc (stored in $forumid). Directly afterwards the bbcode_parse_start hook is called, which you can in turn use to store this info in a way that can be passed to your function.

Also, check out $bbcode->do_parse() and the other subsequently called functions, because it is entirely possible to accomplish this mod without using any file edits (which I'm sure everyone would like). I'll install it such on my site and post the code when I am done.

That is what I'am looking for!

we_scooter 09-08-2007 04:39 PM

:)

I am a fan since HOMELITE for VB2
Definistely INSTALLED thanx TECK
miss TECKWIZARD.com;)

TECK 09-08-2007 04:42 PM

Quote:

Originally Posted by thincom2000 (Post 1334880)
Actually, there is a way. I'll install it such on my site and post the code when I am done.

Glad to see the hackers are still sharing their knowledge. :)

Personally, I will never use this approach. Inserting the code directly is way faster then using it on a hook. Plus, you will need to use all kind of preg_replaces in order to isolate the link.
I never understood why the hook obsession, they actually slow your server... a lot. Who cares if you edit the file and add a small piece of code.

I challenge you to show me a better and faster way, compared to the code I made.
If you win, I pay the beer... :)

thincom2000 09-08-2007 04:43 PM

Okay, here are the updates:
  • eliminated all file & CSS edits
  • added vBulletin Option to open in new window
  • added vBulletin Option for a "this image has been resized" message

In total, there may be 1 additional preg_replace, because the plugins bypass the original IMG bbcode handler. And the template is not eval'd on its own, keeping speed in mind.

Changes to the product file:
  • Added 3 plugins
  • Added 1 template (scroll to bottom for CSS)
  • Added 2 settings

Quote:

Originally Posted by TECK (Post 1334920)
I never understood why the hook obsession, they actually slow your server... a lot.

This is why my site only has one plugin for each hook, with one line of code each. This include()s plugins saved in the file system. :) I think I halved load times by spending a week doing that.

TECK 09-08-2007 04:44 PM

Quote:

Originally Posted by we_scooter (Post 1334919)
miss TECKWIZARD.com;)

Something really big is coming... in few months. :)
A new teckwizards site will evolve... be prepared.

TECK 09-08-2007 04:51 PM

Quote:

Originally Posted by thincom2000 (Post 1334921)
Okay, here are the updates ...

I win! You replaced my 4 lines of code with 285 execution processes. :D
However this is a very good solution, for people who don't want to edit their files.

Now, pay the beer! I'm in Montreal. :D

PixelFx 09-08-2007 04:56 PM

Hey tech long time no chat :D, nice hack :D got a client been looking for something like this for his blog :D

TECK 09-08-2007 06:48 PM

Quote:

Originally Posted by thincom2000 (Post 1334921)
This is why my site only has one plugin for each hook, with one line of code each. This include()s plugins saved in the file system. :) I think I halved load times by spending a week doing that.

Good call, I like your thinking. That is exactly what I do also... Lizard King can confirm how many times I insisted on this matter, for his site. :)
I suggested that to vBulletin team also, for their products. In Project Tools and Blog I replaced all their hook code with files. :)

While doing some benchmarks to emulate 10,000 users hitting a server, the results were shockingly better, compared to the code left in hooks.

Quote:

Originally Posted by PixelFx (Post 1334928)
Hey tech long time no chat :D, nice hack :D got a client been looking for something like this for his blog :D

Glad I could help, Robert. :)

pspmaster93 09-08-2007 10:19 PM

can you include a readme guide for updating from the previous version?

xandizitxu 09-08-2007 10:38 PM

Quote:

Originally Posted by thincom2000 (Post 1334921)
Okay, here are the updates:
  • eliminated all file & CSS edits
  • added vBulletin Option to open in new window
  • added vBulletin Option for a "this image has been resized" message

In total, there may be 1 additional preg_replace, because the plugins bypass the original IMG bbcode handler. And the template is not eval'd on its own, keeping speed in mind.

Changes to the product file:
  • Added 3 plugins
  • Added 1 template (scroll to bottom for CSS)
  • Added 2 settings



This is why my site only has one plugin for each hook, with one line of code each. This include()s plugins saved in the file system. :) I think I halved load times by spending a week doing that.

Okay I installed your product xml, uninstalled the other and now I get this

Quote:

<div><div class="resizednote">This image has been resized for improved display.</div><img src="http://img249.imageshack.us/img249/7245/bscap 0015fb3.jpg" border="0" alt="" class="resizeimage" onload="resize_image(this, 'http://img249.imageshack.us/img249/7245/bscap0015 fb3.jpg', 424);" /></div>

TECK 09-09-2007 12:41 AM

Quote:

Originally Posted by pspmaster93 (Post 1335065)
can you include a readme guide for updating from the previous version?

thincom2000, I think is best for you to release the hack under your own version.
People will ask all the time for support on a piece of code that I did not make... Thanks.

NeutralizeR 09-09-2007 12:28 PM

You suggest making file edits instead of using plugins? (for all products - hacks)

Yeah, it'll be faster but it'll also take so many time when upgrading...

TECK 09-09-2007 03:48 PM

It will take you 30min max to upgrade a heavy modified board... if you know what you are doing. Plus the difference between editing directly the files, compared to hooks usage, is huge. Even the vBulletin developers said that writing the code directly to files is way better then using the hooks. Then, even if you use only hooks, there is no guarantee the code will still work on the new vBulletin version, so you are stuck already. While editing the code by yourself, you learn about PHP and see exactly what it has to be done, in order to fix everything.

The hooks are for people who don't code or are lazy to learn few basics in PHP. Then, why do you want to download hacks if you don't want to learn anything? And how do you know that the plugins you just installed will not destroy your server? Don't take it on a bad way, I simply state the real facts: using hooks is slowing down your code execution. That is compared on real benchmarks. Plus, I bet you 1 million dollars, no (or very few) "hackers" will test their code with benchmarks... just to see how their hack will perform under heavy server stress. You have no idea how many bad hacks you can find here at vBulletin.org site.

The code thincom2000 made is good from a technical point of vue. But what do you think it will execute faster: my 5 lines of code grouped in one location... or his 200 lines spread all over the hooks and templates? Many people don't realize how bad it is to load your board with a lot of hook inserted code.

I'm totally against modifying your vBulletin board. I don't see any need to add a ton of hacks that will not do any good to your server performance. But if I'm forced to do it, I will definitely edit the vBulletin files. I deal with a lot of clients, like corporate people. I build their server from scratch, including the OS with my own RPM's (PHP, MySQL, etc.) and all the needed software for high performance machine/s. Then, when I install vBulletin, I will always recommend not to insert any hacks on it.

NeutralizeR 09-09-2007 03:53 PM

Thanks for the detailed answer.

TECK 09-09-2007 04:14 PM

Thanks and let me state this one more time: thincom2000 did a very good job on the code modification. This has nothing to do with my comments listed above. It is just my personal opinion about using code in hooks.

thincom2000 09-09-2007 06:27 PM

For the ease of support and less confusion in this thread, I have taken TECK's suggestion and opened a support thread for the modified product file I posted earlier. The file is now only available in that thread.

https://vborg.vbsupport.ru/showthread.php?t=157428

Quote:

Originally Posted by xandizitxu (Post 1335072)
Okay I installed your product xml, uninstalled the other and now I get this

Please repost your issue in the other thread, and I will gladly tell you how to fix it, since this was my very first issue when I took on the task of pluginifying it as well.

TECK 09-09-2007 09:08 PM

Good decision, Ted. Congrats on the mod, BTW. :)

JohnnieOO 09-10-2007 06:24 PM

OK, if I am reading this correctly, when installed this will resize pictures as they are uploaded from the user's computer but before being saved on the server? However, they must be attached and not installed with [img] tags? Am I reading this right?

Johnnie

djdonx 09-10-2007 06:44 PM

Johnnie,

When a user puts an image url in [IMG] tags, if the image is bigger than the size you have specified it will shrink the image and make the original image a link.

Also, this works perfect for me. Installed.

thincom2000 09-10-2007 06:56 PM

Quote:

Originally Posted by JohnnieOO (Post 1336402)
OK, if I am reading this correctly, when installed this will resize pictures as they are uploaded from the user's computer but before being saved on the server? However, they must be attached and not installed with [img] tags? Am I reading this right?

Johnnie

What you have described is a default vBulletin feature.

TECK 09-10-2007 11:23 PM

JohnnieOO, this hack applies only to images that you insert using the [IMG] bbcode tag.
In other words, if your board width is set 1024px and the user inserts an image hosted on imageshack.us that has 1900px in width, it will break your design.

My hack will automatically resize that image to load a specific width you desire, eliminating the ugly look your board will get from a very wide image.

nickypoooo 09-11-2007 06:44 AM

Installed, Thank you

Saviour 09-11-2007 05:21 PM

Wonderful hack...Clicked Installed...

I saw in an earlier post, if enough people request it...you would make a code change to state the original image has been edited...

You should actually include that code within your mod...as well as including the code to open the image in a new window...just like the vBulletin default image attachments already do.

It only stands to reason that this would be the best way to go...convenient...and warranted.

Again...thanks for the hack...Kudos!

UNRE4L 09-12-2007 01:33 AM

Does anyone know if theres a similar thing for avatars?

TECK 09-12-2007 03:15 AM

Quote:

Originally Posted by UNRE4L (Post 1337364)
Does anyone know if theres a similar thing for avatars?

Is a default option in vBulletin, no need to hack it. Hmm actually, it will display a warning that your avatar is to big... Let them work a little. :)

Quote:

Originally Posted by Saviour (Post 1337123)
Wonderful hack...Clicked Installed...

I saw in an earlier post, if enough people request it...you would make a code change to state the original image has been edited...

You should actually include that code within your mod...as well as including the code to open the image in a new window...just like the vBulletin default image attachments already do.

It only stands to reason that this would be the best way to go...convenient...and warranted.

Again...thanks for the hack...Kudos!

When I have time, I will do it... I'm in the middle of a server build for a client.

UNRE4L 09-12-2007 08:37 AM

Yeh i dont just want something resized to fit a 400 x 400 box for example.

If their image is 1000 x 600 (ony an example) and they put it in their avatar I want it to keep the proportions but be smaller. So if i state the avatar size to be 400x400 max it would be resized to 400 x 240

If i just left it how it is in VB the image would be stretched to 400 x 400 and unless its a square image to start it looks messed up.

TECK 09-14-2007 05:56 PM

Avatars are stored into database. They have nothing to do with the [IMG] tag. :)

thincom2000 09-14-2007 08:21 PM

Actually, you can configure vBulletin to store avatars (like attachments) in the file system. Thus, an IMG tag would be able to fetch said avatar.

UNRE4L 09-14-2007 09:04 PM

Yeh my avatars are saved to folders along with all other images rather than having a huge database file.

eghm 09-15-2007 05:19 AM

Thanks for this Product!

I'ld like to suggest updating the readme.html CSS Main edit from "second text area" to "Page Background: Extra CSS Attributes" adding that the Main CSS is under the Style Manager might help newbies a bit too.

I've installed this on my testvb and see it works for FireFox. On Safari (Mac OS X browser) the image looks squeezed (which I can live with, given the see full sized image option) and the css doesn't work correctly (which I probably can't live with) - http://s229.photobucket.com/albums/e...zeOnSafari.png

Acers 09-15-2007 06:46 AM

TECK, great hack m8,
just wondering though, when the javascript detects a image is greater than specified, can't the link window be somehow set to say rel="lightbox" and then the final image opens up in a new lightbox window?

EDIT: Never mind, i got the lightbox working with this code. Works brilliantly now.

offline 09-17-2007 12:39 AM

Hello! I have installed this and it works great, I only have on small problem. The image is not clickable to view the orginal. I am using IE7. Any help is appreciated. http://www.chattanoogans.com/forums/...ge-resize.html

Thanks!

offline 09-17-2007 12:54 AM

Sorry, try this post... http://www.chattanoogans.com/forums/...size-test.html

sportsoutlaw 09-18-2007 03:06 AM

I have been looking or something like this, thanks for your work Teck

TECK 09-20-2007 05:49 AM

Quote:

Originally Posted by Acers (Post 1339360)
Just wondering though, when the javascript detects a image is greater than specified, can't the link window be somehow set to say rel="lightbox" and then the final image opens up in a new lightbox window?

You could use this:
Code:

obj.rel = 'lightbox';

TECK 09-20-2007 05:51 AM

Quote:

Originally Posted by offline (Post 1340540)
I only have on small problem. The image is not clickable to view the original. I am using IE7.

This hack was tested and working in all major browsers. :)

Acers 09-20-2007 07:02 AM

Quote:

Originally Posted by TECK (Post 1342919)
You could use this:
Code:

obj.rel = 'lightbox';

yes teck, i had got that working. :)
thanks anyway.

Mosh 09-21-2007 07:25 AM

Hi Floren,

Just to let you know that this works on v 3.5.x with no changes apart from editing the product to remove the version dependancy. I works great.

Only one thing I would request, as some others have requested, is to add a label/notice to let people know that it is a resized image. This is not urgent, but would be a great help for people who do not read announcements or bbcode descriptions.

Thanks :)

Charlie98902 09-22-2007 12:14 AM

Wrong Thread sorry.


All times are GMT. The time now is 07:55 AM.

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.04309 seconds
  • Memory Usage 1,842KB
  • 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
  • (18)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
  • (40)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