vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.7 Template Modifications (https://vborg.vbsupport.ru/forumdisplay.php?f=229)
-   -   Integration with vBulletin - Lytebox Intergration. Allows image groups, slideshows and works with embeded images. (https://vborg.vbsupport.ru/showthread.php?t=179998)

D.Baker 05-20-2008 10:00 PM

Lytebox Intergration. Allows image groups, slideshows and works with embeded images.
 
This mod has be made redundant by The Image Resizer by TCattitude. So, I no longer support it and recommend you use his plugin instead, it's much better!

This isn't the best mini-mod out there, and I'm not even sure if it's technically a mod. It's closer to a "how to" document than a mod. This works better than most of the proper Lytebox mods out there as it allows image grouping or slideshows (can't have both) and works with images embeded in posts (using ATTACH BBcode, or the little paper clip) . I'm not sure if it works with images in signatures, try it out and let me know. It does not do anything to images embedded using the IMG BBcode (it only works on images linked to by a thumbnail).

LIVE DEMO: Here. Note that I am using the image group feature instead of the slideshow feature.

Anyway, here it is.

If you would like to get Lytebox working with vB 3.7.0 (this should work with other versions, but this is all I have tested it on). You need to do the following.

1) Download latest version of Lytebox here.

2) Edit lytebox.js to your desired settings (can just leave as default if you want).

3) Edit lytebox.css using a find-and-replace tool (even Notepad will do this). You need to swap all the words:
HTML Code:

images
for:
HTML Code:

../images/lytebox
4) Upload lytebox's images folder to "/images/lytebox" using FTP.

5) Upload lytebox.js and lytebox.css to "/clientscript" using FTP.

6) In AdminCP, go to Styles & Templates>Replacement Variable Manager and create a new replacment variable. Set it to replace:
HTML Code:

rel="Lightbox"
with:
HTML Code:

rel="lytebox"
If you want to use the image group feature then replace
HTML Code:

rel="Lightbox"
with:
HTML Code:

rel="lytebox[group]"
This will make all attached/embeded images in the one thread display in lytebox as a group (I am still working on how to make only images from the one post group).

If you want to use the lyteshow feature then replace
HTML Code:

rel="Lightbox"
with:
HTML Code:

rel="lyteshow[group]"
This will make all attached/embeded images in the one thread display in lytebox as a slidshow (I am still working on how to rhis with only images from the one post ).
7) In AdminCP, go Style Manager>Edit Templates>Show Thread Templates>SHOWTHREAD. Click Customize (or Edit) and replace the following code:

Code:

<if condition="$show['lightbox']">
<!-- lightbox scripts -->
    <script type="text/javascript" src="clientscript/vbulletin_lightbox.js?v=$vboptions[simpleversion]"></script>
    <script type="text/javascript">
    <!--
    vBulletin.register_control("vB_Lightbox_Container", "posts", $vboptions[lightboxenabled]);
    //-->
    </script>
<!-- / lightbox scripts -->
</if>

with this code:

Code:

<if condition="$show['lightbox']">
<!-- lightbox scripts -->
    <script type="text/javascript" language="javascript" src="clientscript/lytebox.js"></script>
    <link rel="stylesheet" href="clientscript/lytebox.css" type="text/css" media="screen" />
<!-- / lightbox scripts -->
</if>

8) You need to move the above code into the head section of the SHOWTHREAD template. To do this, you simply cut it and paste it right above the <HEAD> tag.

9) Repeat steps 7 and 8 for the SHOWTHREAD_SHOWPOST template. You can find this template by going into Style Manager>Edit Templates>Show Thread Templates>SHOWTHREAD_SHOWPOST. This will get lytebox working on the individual post page.

10) In AdminCP you need to turn on thumbnails and Lightbox (note that it refers to Lightbox, not lytebox. This is OK). You can do this in the AdminCP at vBulletin Options>Message Attachment Options.

11) Make sure that your images aren't set to load in a New Window. You can change this in the AdminCP at Attachments>Attachments Manager.

12) To enable images embedded using the IMG tag to be resized and enlarged using lytebox, you need to install JASE2's Image Resizer plugin from here and make some code changes.
Make sure you you set Image Resizer to enlarge images in a new window. You do this in AdminCP vBulletin Options>Image Resizer Options>Default Resize Mode and set it to "Open in new window". You also need to set the size you want the IMG embedded images resized to (I set them to the same as my thumbnail settings).
13) Using FTP, browse to /includes/ and edit the following line of PHP code in the file "class_bbcode.php".

PHP Code:

return '<img src="' .  $link '" border="0" alt="" />'

change to:

PHP Code:

return '<a target="_blank" href="' $link '" rel="lytebox[group]"><img src="' $link '" border="0" alt="" /></a>'

NOTE: If you want to use the slideshow feature, simply use rel="lyteshow[group]" rather than rel="lytebox[group]".

14) To remove the yellow warning box from images embedded using IMG tags, add the following CSS to your style.

Code:

.ncode_imageresizer_warning {
    display: none;
}


v1.2

Provides a way to resize images embedded using IMG. It's not perfect, but it works in the meantime.

v1.1
Works when viewing a single post.
Allows for slideshows using lyteshow.


Credits:
Thanks to Andy Huang from the vB team.
Thanks to Lost Heaven for coming up with the code I used in step 13.
Of course, thanks to Markus F. Hay for Lytebox.

anestetic 05-21-2008 10:00 AM

what is demo or caps ?

D.Baker 05-21-2008 10:08 AM

Sorry, I don't understand what your referring too.

dannykilla 05-21-2008 10:11 AM

Whats the difference between this and the Image resizer using lytebox hack/mod ?

thanks
Danny

D.Baker 05-21-2008 10:26 AM

My mod works for images that are embedded in a post, it also allows images to be grouped or displayed in as a slide show. Image Resizer does not do these things.

It does not allow resizing images to a set dimension, but it does auto resize images if they are larger than the viewers screen dimensions.

dannykilla 05-21-2008 10:27 AM

awesome would there be any future update to allow the resizing of images for a specific set dimension?

D.Baker 05-21-2008 12:02 PM

If I understand you correctly, and correct me if I'm wrong, but I don't see how that would be any different than what you can do in vB already. Just set the maximum image size to whatever you want it to be in the Attachment Manager (I have attached a screenshot of my recommended settings). Then in vBOptions>Message Attachment Options set the following:

Resize Images: Yes
View Attached Images Inline: Yes
Thumbnail Creation: Yes
Thumbnail Size: 180 (Or whatever you want)

This will mean the end result is that every image attached is displayed by a thumbnail and when clicked on, it will expand with Lytebox to be the size you set in Attachment Manager, which in my case is 1000px wide. If the end user has a screen resolution smaller than 1000px wide, then it automatically down sizes it. What else would you need to do? Setting Lytebox to auto scale images can be achived by changing the size restraints in Attachment Manager.

Keep in mind that Lytebox (so, any plugin based on it ) doesn't actually resize the image file, it just scales it. If you've been running a board for a while now and want to resize all the old images that have been uploaded, any plugin based on Lytebox isn't going to help you reduce the actual image size. All they can do is scale images for the end user, or if combined with a proper PHP based image resizer, replicate the features already in vBulletin board.

That being said, I did not code this plugin. I just compiled a step-by-step on how to intergrate an exsisting web app into vBulletin. So, no I won't be releasing a version that can resize images to a certian size, as I don't see how that's any different than what vBulletin allows you to do already (and I don't know that much about coding).

iogames 05-21-2008 08:55 PM

does it work for 3.6.10? :rolleyes:

D.Baker 05-22-2008 02:02 AM

I'm not sure, I don't see why not. As long as the templates work the same. Give it a try. Do a backup before though, just to be safe. Like I siad in my post above, I've only used it in 3.7.0. I actually only started using vBulletin about a week ago, so I'm not really the guy to ask about these things. I just made this little mod becuase I really needed Lytebox to wrok properly.

Wayne Luke 05-22-2008 04:16 PM

Quote:

Originally Posted by iogames (Post 1527292)
does it work for 3.6.10? :rolleyes:

3.6.10 doesn't have Lightbox functionality by default so it won't find the replacements and set the relations properly.

DoB Rhapsody 05-22-2008 07:37 PM

demo please..

D.Baker 05-23-2008 12:19 PM

LIVE DEMO: Here. Note that I am using the image group feature instead of the slideshow feature.

Stoebi 05-23-2008 06:09 PM

how can i set a comment for evey image, please?

Demo here:
http://www.dolem.com/lytebox/misc/jupiter_io_thumb.jpg

Allan 05-23-2008 06:31 PM

Very nice this hack, i like it, congrat :)

bmwusa 05-23-2008 06:53 PM

just what i was looking for thanks!

DoB Rhapsody 05-23-2008 07:53 PM

Quote:

Originally Posted by D.Baker (Post 1528898)
LIVE DEMO: Here. Note that I am using the image group feature instead of the slideshow feature.

ok, great. I'll definitely install this when it works for the IMG tag.

vitoreis 05-23-2008 11:53 PM

Quote:

Originally Posted by DoB Rhapsody (Post 1529337)
ok, great. I'll definitely install this when it works for the IMG tag.

Waiting for IMG too :) Thanks D.Baker!

D.Baker 05-24-2008 07:36 AM

Thanks for the feedback guys. I have contacted JASE2 of Image Resizer to see if it's possible for him to support vb 3.70's inbuilt version of Lightbox, or even better, for us to merge our two modes together.

If he supports vB's Lightbox with the "open in new window" feature of his plugin, I'm pretty sure that my mod will then work with his, as it replaces all Lightbox calls with lytebox, so I'm pretty sure it would work. Otherwise, I am stumped. I don't know enough about JavaScript to edit his plugin to ad the necessary rel="lytebox" tags on his open in new window commands. I have tried messing around with it, but I couldn't get it working. I haven't heard anything back from him yet. I'll keep you posted. If he does get back to me, this plugin will be the ultimate lightbox plugin.

As for getting all images in a single post to group, I posted a support request here, but haven't heard anything back yet. If anyone knows the answer, please let me know.

D.Baker 05-24-2008 08:32 AM

OK, I figured out how to get it to resize images embedded using IMG tags! :D

It's not perfect. It requires another plug (which you might already be using). It also removes the images paddings, so they sit right on top of each other. But its prett close to working perfect.

Let me know what you think, and if you can see a better way of doing it. I'd love to know.

pedroenf 05-24-2008 09:31 AM

Fantastic!! Now it is really perfect. Thank you for your efforts.

D.Baker 05-24-2008 01:35 PM

If you'd prefer to remove the warning tabs permanently, you can do it by commenting out (put a // in front of the code) lines 111 to 149 in Image Resizer's, "ncode_imageresizer.js" file although I'm not sure how legal that is due to copyrights.

My mod/hack/whatever isn't perfect yet. The Image Resizer plugin is not at all xhtml valid (but then again, neither is vBulletin) which bugs me (I like to know I've done it 100% right). Also, there should be a margin of 2px around the images, but I can't get Image Resizer to accept inline styles (like vB applies to all attached images). I just don't know enough about JavaScript.

The other thing is, I hate having to edit edit templates enough, and I personally draw the line at editing core files outside of the vB AdminCP. So I have decided that personally won't use the method described in step 13. I'm just going to have those images non-lyteboxed untill I figure something else out. There are two reasons for this. Firstly, any vB updates in the future to that file will remove that code, and secondly, it's not xhtml valid and the code it generates is messy (which is even more messy thanks to Image Resizers invalid code).

Hopefully JASE gets back to me (or someone else who knows JavaScript) about tweaking his file to include a rel=lytebox[group] tag in the image embed code.

But for people who don't care about those kinds of things, this mod works pretty close to perfect (everything except the 2px margin IMG embeds) for embedding images using ATTACH, IMG and by attaching images to a post. It will display lyteshows or grouped images.

pedroenf 05-25-2008 10:12 AM

I there. Is there any way to increase the size of the images in lytebox? What i mean is when we click the image it won't get the original size so, consequently, the image looses some quality. I have my image permissions to allow 1024*1024 images (in attachments). Thanks.

D.Baker 05-25-2008 12:03 PM

Hey pedroenf, you set that in lytebox.js.

There is a line about auto resizing images, set it to false. That will mean images will enlarge to their real size. It's a problem for people with smaller screens, but 1024*1024 is borderline OK.

pedroenf 05-25-2008 02:04 PM

Thanks D.Baker.

BeerLuver 07-01-2008 07:41 AM

Great mod, but one thing I am curious about. I set it up to resize images posted using the IMG tags, BUT how would I get it to NOT include the images members post in their signatures using the IMG tags? So when they want to browse through all images in a thread posted via IMG tags within their posts, it won't include the signature images as well? Any ideas on how to get around that or exclude those?

D.Baker 07-05-2008 02:14 AM

Hey BeerLuver,
That's a tough one. Step 13 is what's causing that. I myself have decided not to use this with the Image Resizer mod because of that very reason (and because I don't like editing core files), meaning I just skipped step 13 and 14See an example of the end result here. I've been trying to get Jase2 to get his mod working with Lightbox (the version that comes with vB) and that way it would also work with this mod (or at least I'd then be able to figure out how to get it working with this mod), but he hasn't done it yet.

So, the way this mod works at the moment is if you want to have IMG images open as a group using lytebox, then your signatures will too. Sorry, I wish I was smarter.

If anyone knows a little about JavaScript I'm sure it would be super easy to tweak Jase2's code to work with my mod, I can help jsut let me know what you need.

BeerLuver 07-05-2008 02:43 AM

I'm wondering if there is some type of IF statement that could be used to ignore any images within the signature bits of code? I'm not very code savvy myself, so I wouldn't know how to get that working either heh. Or it'd be nice if the Lytebox could be set to work on individual images; not as a group, so when they click on one image, that's the only image it displays then. That might work for a work-around idea.

D.Baker 07-06-2008 01:56 AM

Hey BeerLuver,
I wish I knew more coding.

As for getting a single image to open rather than a group, that is easy. See step 6 of my hack/mod above.

-Baker

BeerLuver 07-06-2008 06:58 AM

Well, for now, I disabled the IMG bb code in signatures and allowed HTML image linking instead. I know it's not a safer way, but if I wanna use the lytebox with the IMG tag, needed to enable html in sigs and disable the img tag in sigs cause otherwise, if ya clicked on a linked image in someone's sig... it's only open that image in lytebox, and not actually open the link. I have close moderation of the forums too, so I'm not too concerned for misuse of the signatures with html, and any malicious use of em... automatic permanent ban for that person then heh.

Thanks for all your hard work on this mod though :).

Walter Ronny 07-08-2008 11:51 AM

this will works in the last version 3.7.1?

redlabour 07-09-2008 05:50 AM

This works easier without any Edits even for Blogs and Albums : The Image Resizer (powered with Lytebox / Highslide) ;)

ExTincTi0N 12-17-2008 10:23 PM

Is there anyway to make it use the lytebox instead of opening up in a new window or tab without having to use the attachment option? If so I would really like some support with this.


All times are GMT. The time now is 09:06 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.01331 seconds
  • Memory Usage 1,833KB
  • 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
  • (3)bbcode_code_printable
  • (8)bbcode_html_printable
  • (2)bbcode_php_printable
  • (3)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (32)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete