![]() |
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 |
I am not sure what the "clientscript directory" is?
|
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.
|
I found it in httpdocs/forums/...
I've uploaded it and can't seem to get it functioning. Have you had any luck? |
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.
|
This worked perfect on my 3.0.3 install - thanks for a great mod!
|
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 |
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%. |
Quote:
Could I change my editor setting to "standard" and this would work? Or no? |
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. |
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]" /> HTML Code:
<img src="$stylevar[titleimage]" border="0" alt="$vboptions[bbtitle]" id="forumlogo"/> |
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? |
Quote:
Quote:
|
|
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 |
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?
|
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:
Quote:
Quote:
I think this should be added to the original hack :nervous: |
Great hack! acidburn0520 clicks install!
|
this isnt working for me, could i get some help :|
|
It's a fairly straight-forward modification, what's the problem?
|
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? |
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
|
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) { |
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 |
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
|
ahhh.... NAVBAR :)
|
Quote:
normal showthread pics are resizing normally ? PLEASE HELP! :) |
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:
|
Quote:
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. |
I don't have 3.5 but I'm glad you got it working
|
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? |
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! |
Quote:
is this possible to make this with this script? |
Superb. Thank you
|
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 | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|