vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.0 Template Modifications (https://vborg.vbsupport.ru/forumdisplay.php?f=134)
-   -   auto resize huge images (https://vborg.vbsupport.ru/showthread.php?t=90208)

Tradjick 12-19-2004 10:00 PM

auto resize huge images
 
This Hack has been published by mr.gamesbay in this thread at vbulletin-germany.com who let me translate this hack for vb.org.

It resizes the pictures from the [img] tag after showthread.php has been loaded. It doesn?t need any editing of php files.

Other similar hacks:

https://vborg.vbsupport.ru/showthread.php?t=67743 from St.Lauren which has the drawback of beeing slow.
https://vborg.vbsupport.ru/showthread.php?t=68677 fron 007pig which doesn?t always cut down the img size of each picture and makes each picture as a link.
and the hack from Aurous: an ideal version, very fast and no problems with broken links. But there are problems with the use of the WYSIWYG editor and caching. (BTW, this hack doesn?t solve the WYSIWYG thingy. If you find a solution, feel free to share it with the rest)

Advantages of this version:

-fast
-works with cache enabled
-no editing of php files, just template edits

Here?s what you need to do:

Styles & Templates > Style Manager > All Style options > Additional CSS Definitions:
go to the bottom of it and add the following:

.imglimit {cursor: pointer;border: dotted 1px black;}

Styles & Templates > Style Manager > Common Templates > headinclude:
Find:

HTML Code:
<script type="text/javascript"><!--var SESSIONURL = "$session[sessionurl]";var IMGDIR_MISC = "$stylevar[imgdir_misc]";// --></script>


Behind that, add the following code:

HTML Code:
<script type="text/javascript" src="clientscript/resizeall.js"></script>


Styles & Templates > Edit Templates > showthread:

Find:

HTML Code:
<body onload="$onload">


Replace with:

HTML Code:
<body onload="$onload; fiImageResize()">


Then, you will have to updload resizeall.js to your clientscript directory and that?s all.

In the file resizeall.js you have the option to choose the size for the images.


Demo: http://www.gamesbay.de/showthread.php?t=3316

Mechanical Mind 12-23-2004 10:11 PM

I am not sure what the "clientscript directory" is?

peterska2 12-23-2004 10:42 PM

it's one of the directories off your forum root one. It's usually listed in FTP after admincp and archive and is actually called clientscript.

Mechanical Mind 12-23-2004 10:43 PM

I found it in httpdocs/forums/...
I've uploaded it and can't seem to get it functioning.

Have you had any luck?

peterska2 12-23-2004 11:00 PM

I've not actually tried it as I'm upto my neck in writing a hack at the moment which is just doing my head in but I don't want to change anything else on my localhost until thats finished and I never do a live install untill I've done a localhost one as my site is that hacked.

imported_SloChild 12-26-2004 05:03 AM

This worked perfect on my 3.0.3 install - thanks for a great mod!

Mechanical Mind 12-26-2004 01:40 PM

I was originally having problems with this, so I decided to wipe it out and try again. Next time, I made more progress. (I think the first time I uploaded the file to the wrong directory). This time, I followed the directions to the word, very closely.

Now, this is happening: I can resize the image inside of the text editor, but when you save and view the thread, the image is still the original dimensions?

Any follow-up? I really need this hack to work. :o

Tradjick 12-26-2004 04:11 PM

I´m sorry, but i don´t have a solution to the problem with the WYSIWYG editor and when you return to the thread after posting a message.
You might try to ask the question at the link to vulletin-germany.com but i once asked and nobody came up with a solution.
You might try to set a fix width in maincss unstead of having it set to 100%.

Mechanical Mind 12-26-2004 04:16 PM

Quote:

Originally Posted by Tradj
I?m sorry, but i don?t have a solution to the problem with the WYSIWYG editor and when you return to the thread after posting a message.
You might try to ask the question at the link to vulletin-germany.com but i once asked and nobody came up with a solution.
You might try to set a fix width in maincss unstead of having it set to 100%.

So does this hack just not work with the WYSIWYG editor? Or doesn't it work at all? I am a little bit confused... :confused: :)

Could I change my editor setting to "standard" and this would work? Or no?

Tradjick 12-27-2004 02:40 AM

It works very well for me. It´s quick and doesn´t have any problem with broken links.

I suggest that you properly install it on a testserver, so that you can play around and test things with standart/wysiwyg editor, replying, etc.
In your case you´d have to place the file in httpdocs/forums/clientscript/resizeall.js
Make sure that directory is chmoded to 777. You can do that with an ftp client.

Inform me if you should have any more problems, and i´ll take more time to have a look.

SecTa 02-23-2005 09:58 PM

If you don't want your logo to be resized, following changes should be done:
Styles & Templates-> Style Manager-> Edit Templates-> Header:
find
HTML Code:

<img src="$stylevar[titleimage]" border="0" alt="$vboptions[bbtitle]" />
replace with
HTML Code:

<img src="$stylevar[titleimage]" border="0" alt="$vboptions[bbtitle]" id="forumlogo"/>
Info was taken from here

mustang_lex 06-04-2005 09:43 PM

Ok .I got mine working. A few things I modified for others who may care.

I use vb 3.0.7 so I don't know if this will work for older boards

The original hack works once the thread has been posted. however I noticed that when you post a new thread and "preview" it or reply and "preview" it, the photo is still full size.

I thought I fixed it but I had 007pigs hack installed too and since removing it ( i like this one better because it works better) the "preview" still shows it full size.

I tried replacing the body tag in templetes newreply and newthread but got errors and the image link wouldn't work :confused: any ideas

Maybe its a javascript setting in newpost_preview templete?

mustang_lex 06-06-2005 03:38 PM

Quote:

Originally Posted by SecTa
If you don't want your logo to be resized, following changes should be done:
Styles & Templates-> Style Manager-> Edit Templates-> Header:
find
HTML Code:

<img src="$stylevar[titleimage]" border="0" alt="$vboptions[bbtitle]" />
replace with
HTML Code:

<img src="$stylevar[titleimage]" border="0" alt="$vboptions[bbtitle]" id="forumlogo"/>
Info was taken from here

Adding the
Quote:

id="forumlogo"
for any image works great. thanks. I have a image for my footer which was resized, but after adding the id part. It was fixed. :)

mr.gamesbay 07-02-2005 02:28 AM

*click install* lol ;)
The Demo Link has changed:
http://www.gamesbay.de/showthread.php?t=25

mustang_lex 07-03-2005 09:59 PM

Is there a way in the resizeall.js clientscript so any resized photos will have text under it saying something like "this photo has been resized automatically, click for full view"

Thanks

mustang_lex 07-05-2005 01:43 PM

I had to uninstall this hack and use another because my smilies wouldn't work on new post or reply, but the new one is god awful slow on the server, so now I want this one back but I can have the problem. Has anyone encountered this?

mustang_lex 07-05-2005 03:00 PM

Ok the problem with this hack is that it doesn't work with newreply or newpost and it has to do with the editInit() for the body onload part. So I'm trying to figure out how to load to variables in the body tag. I tried using a Javascript call but doesn't work

here the out put if I just do as the hack suggests and change the BODY tag in the newreply or repost . the end result is <body onload="editInit();" onload="fiImageResize();">

If we can load both the editInit() AND fiImageResize() in the <BODY> it will work I believe. BUT HOW!!!


****************************
THIS IS THE FIX TO MAKE IT WORK!!
****************************

As I stated I had a problem with this hack when it came to new threads (when you do a preview) and new replys. I been doing some research and I'm sure this was no brainer for many, but I'm pretty happy with it.

In newreply and newthread

look for
Quote:

<body onload="$onload">
or in my case
Quote:

<body$onload>
and replace it with

Quote:

<body onload="editInit();fiImageResize();">
And you will have this hack work for SHOWTHREAD , newreply and newthread!!

I think this should be added to the original hack :nervous:

Kirk Y 07-24-2005 04:00 PM

Great hack! acidburn0520 clicks install!

Blindchild02 07-25-2005 06:50 PM

this isnt working for me, could i get some help :|

Kirk Y 07-25-2005 07:43 PM

It's a fairly straight-forward modification, what's the problem?

Blindchild02 07-25-2005 07:45 PM

i dont know, i did all the modifications and uploaded the file.... but it doesnt seem to work.

do i have to refresh anything, or something like that?

Blindchild02 07-26-2005 01:15 AM

well, i did it again ... still doesnt work, are there any certain settings i need to change or anything... please help i really need this hack

Marris 08-02-2005 04:32 AM

Does anyone have any idea how to make this so the full sized image is opened in a window sized to fit the image?

I tried the following changes below, but it's not working. It seems to work on some images but not on others.

If someone could suggest how to return the proper height and width values from the clicked image, that would be a great help towards making this work.

TIA

Code:

function fiImageWinOpen(e) {
        if( window.event ){
                var wwidth = window.event.srcElement.width+140;
                var wheight = window.event.srcElement.height+140;
          window.open(window.event.srcElement.src,'OriginalSize','menubar=no, toolbar=no, location=no, directories=no, fullscreen=no, titlebar=no, hotkeys=no, status=no, scrollbars=yes, resizable=yes, width='+wwidth+', Height='+wheight); 
}        else {
          var wwidth = E.target.width+140;
          var wheight = E.target.height+140;
          window.open(e.target.src,'OriginalSize','menubar=no, toolbar=no, location=no, directories=no, fullscreen=no, titlebar=no, hotkeys=no, status=no, scrollbars=yes, resizable=yes, width='+wwidth+', Height='+wheight);
          }
}


majorj0nny 08-04-2005 10:35 AM

Im really eager to use this great hack... Ive set it up with the additions for header exclusion and replythread stuff... but I still have a random resized image on the bottom of posts and I cant find where this area is ? to try to do a similar thing that was done with the header. (if you know what I mean?)

here is an example :

http://www.50klicks.com/jon/bar.jpg

the image itself is clear.gif - which is only 1x1 pixels, but clear is a spacer aint it? so perhaps its stretched/repeated over that length...

I just want to find how to exclude this image element from the re-size process to make this hack perfect for my forums...

thanks in advance.

Jon

EDIT - not a brilliant example in that pic really - but that resized bar appears like that at the bottom of every post 'block' in a thread.

better example :

http://www.50klicks.com/jon/bar2.jpg

majorj0nny 08-05-2005 09:10 AM

ok =- sorted the issue of the resized box at the bottom of the forum posts - by adding the id=forumlogo thing to the clear.gif in the postbit? ... still have one in the legacy part though? will look see

majorj0nny 10-11-2005 10:04 AM

ahhh.... NAVBAR :)

majorj0nny 10-12-2005 02:19 PM

Quote:

Originally Posted by mustang_lex
Ok the problem with this hack is that it doesn't work with newreply or newpost and it has to do with the editInit() for the body onload part. So I'm trying to figure out how to load to variables in the body tag. I tried using a Javascript call but doesn't work

here the out put if I just do as the hack suggests and change the BODY tag in the newreply or repost . the end result is <body onload="editInit();" onload="fiImageResize();">

If we can load both the editInit() AND fiImageResize() in the <BODY> it will work I believe. BUT HOW!!!


****************************
THIS IS THE FIX TO MAKE IT WORK!!
****************************

As I stated I had a problem with this hack when it came to new threads (when you do a preview) and new replys. I been doing some research and I'm sure this was no brainer for many, but I'm pretty happy with it.

In newreply and newthread

look for

or in my case


and replace it with



And you will have this hack work for SHOWTHREAD , newreply and newthread!!

I think this should be added to the original hack :nervous:

hmmm.... this worked perfectly with 3.0.7 but since updating to 3.5.0 the newreply/newthread parts dont seem to resize anymore ?

normal showthread pics are resizing normally ?

PLEASE HELP! :)

majorj0nny 10-14-2005 01:43 PM

this seems to have changed in vb3.5 for some reason...

now on accessing a new reply to a thread that's images have been successfully resized - it brings up errors on page as follows :

Quote:

Line : 543
Char: 1
Error: Object Expected
Code: 0
URL: http://www.50klicks.com/forum/newrep...wreply&p=33762
anyone have any ideas ?

majorj0nny 10-15-2005 10:04 AM

Quote:

Originally Posted by majorj0nny
this seems to have changed in vb3.5 for some reason...

now on accessing a new reply to a thread that's images have been successfully resized - it brings up errors on page as follows :



anyone have any ideas ?


ok seems to have fixed this ... for some reason it no longer liked

<body onload="editInit();fiImageResize();">

in the newreply/newthread bits...

instead I used

<body onload="$onload; fiImageResize()">

which worked fine.

mustang_lex 02-12-2006 08:01 PM

I don't have 3.5 but I'm glad you got it working

joker2040 03-17-2006 10:04 AM

Ok I've got the same problem with clear.gif. I fixed it everywhere except for when you are actually inside of a post.

Thoughts?

joker2040 03-17-2006 10:15 AM

I fixed it... I'm retarded... There was a very skinny black line in my style that was causing the problem. I'm all good now.

Nice mod by the way!

J82980BA3E43 03-23-2006 01:35 PM

Quote:

Originally Posted by mustang_lex
Is there a way in the resizeall.js clientscript so any resized photos will have text under it saying something like "this photo has been resized automatically, click for full view"

Thanks

Help
is this possible to make this with this script?

nesh 05-31-2008 04:09 AM

Superb. Thank you

angelpie 06-12-2008 02:02 PM

does this only resize photos? we have icons too just dont want to add this and it make them larger then we want...


All times are GMT. The time now is 04:47 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.02384 seconds
  • Memory Usage 1,829KB
  • 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
  • (1)bbcode_code_printable
  • (4)bbcode_html_printable
  • (10)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (35)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