[2.0.11] Resize Posted Images Based on Max Width

The cleanup is complete. This forum is now read only.

Rating:

Excellent!
46
64%
Very Good
10
14%
Good
10
14%
Fair
3
4%
Poor
3
4%
 
Total votes: 72

Bullfn33
Registered User
Posts: 92
Joined: Mon Jan 29, 2007 2:29 am

Re: [2.0.11] Resize Posted Images Based on Max Width

Post by Bullfn33 » Wed Jul 11, 2007 12:25 am

I'm sorry, but does that mean it is or isn't suppose to show up? I thought that users just click on the picture to go to the URL for the original size.

Brad-sd
Registered User
Posts: 2
Joined: Sun Jun 03, 2007 9:49 am

Re: [2.0.11] Resize Posted Images Based on Max Width

Post by Brad-sd » Fri Jul 13, 2007 6:56 pm

This is a very handy mod. I've been running it on phpbb 2.0.22 for a month with no problems.

Is there a way to have this mod apply to images posted as attachments? I no longer have the attachment mod running, but when I did, those images were blowing out my layouts.

-Thanks

User avatar
xmenfile
Registered User
Posts: 163
Joined: Sun Apr 22, 2007 10:32 pm

Re: [2.0.11] Resize Posted Images Based on Max Width

Post by xmenfile » Tue Aug 21, 2007 6:23 am

Hi,

I installed this with "resize avatars base on max width and height", but somehow only 1 of them works. can anyone help me how to make them both works together?

Thanks,

User avatar
xmenfile
Registered User
Posts: 163
Joined: Sun Apr 22, 2007 10:32 pm

Re: [2.0.11] Resize Posted Images Based on Max Width

Post by xmenfile » Wed Aug 22, 2007 1:49 pm

Anyone????

diabolic.bg
Registered User
Posts: 447
Joined: Mon Dec 11, 2006 3:41 pm
Location: Bulgaria, Sofia
Contact:

Re: [2.0.11] Resize Posted Images Based on Max Width

Post by diabolic.bg » Sat Aug 25, 2007 6:17 pm

I have installed this mod with Resize Uploaded Avatars and Remote Avatar Resize.
All 3 mods works fine. Maybe you must change your choice. :D

cornick
Registered User
Posts: 142
Joined: Fri May 19, 2006 12:55 am
Location: New York
Contact:

Re: [2.0.11] Resize Posted Images Based on Max Width

Post by cornick » Fri Aug 31, 2007 6:01 pm

cornick wrote:Not a huge fan of the border around the images, is there a way of removing that?
No ideas on this one?

Irn-Bru
Registered User
Posts: 11
Joined: Wed Aug 29, 2007 1:56 pm

Re: [2.0.11] Resize Posted Images Based on Max Width

Post by Irn-Bru » Fri Aug 31, 2007 11:13 pm

cornick wrote:No ideas on this one?
Yeah I managed to change it.

If you open your <your template>/overall_header.tpl file and find:

Code: Select all

var rmw_max_width = 400; // you can change this number, this is the max width in pixels for posted images
var rmw_border_1 = '1px solid {T_BODY_LINK}';
var rmw_border_2 = '2px dotted {T_BODY_LINK}';
var rmw_image_title = '{L_RMW_IMAGE_TITLE}';
...you can change the solid or dotted line(s) to:

Code: Select all

var rmw_max_width = 400; // you can change this number, this is the max width in pixels for posted images
var rmw_border_1 = '0px solid {T_BODY_LINK}';
var rmw_border_2 = '0px dotted {T_BODY_LINK}';
var rmw_image_title = '{L_RMW_IMAGE_TITLE}';
...and it'll remove the border. You might have to change it in your <your template>/simple_header.tpl as well, but I only needed to change it in the first file I mentioned.

binhaus
Registered User
Posts: 20
Joined: Mon Nov 20, 2006 5:22 am

Re: [2.0.11] Resize Posted Images Based on Max Width

Post by binhaus » Sat Sep 01, 2007 3:12 pm

Hi.. this it great MOD i have used it for long time.. no issue at all
but now i have some sponsor and they would like to put some type of banner on the popup images, they may be java, iframe, or images ..
any one have ideas ...!!
thanks for any information
:cry: :cry:

cornick
Registered User
Posts: 142
Joined: Fri May 19, 2006 12:55 am
Location: New York
Contact:

Re: [2.0.11] Resize Posted Images Based on Max Width

Post by cornick » Tue Sep 04, 2007 6:09 pm

Awesome, thanks Irn-Bru.

Has anyone thought of making this mod an option for users? Some users want to use it...some users don't. So it's an option in their CP?

rickyboyce
Registered User
Posts: 17
Joined: Mon Sep 24, 2007 12:58 am
Contact:

Re: [2.0.11] Resize Posted Images Based on Max Width

Post by rickyboyce » Tue Sep 25, 2007 3:25 am

is there anyway of removing the popup link!!! cause banners that get resized down have a popup instead of a link!!!

Grashopr
Registered User
Posts: 7
Joined: Sun Sep 18, 2005 6:24 am

Re: [2.0.11] Resize Posted Images Based on Max Width

Post by Grashopr » Tue Sep 25, 2007 4:49 pm

Blisk wrote:This mod doesn't work ok.
So I installed this one.
find this in bbcode.tpl it is only a part of file

Code: Select all

<!-- BEGIN img -->
and replace with this

Code: Select all

<!-- BEGIN img --><img src="{URL}" alt="Image" title="Image" border="0" onload="if(this.width > screen.width-454) {this.width=(screen.width-454); this.className='clickable'; }" onclick="if(this.width >= screen.width-454) { window.open('{URL}', '_blank'); return false; }" alt="Klikni za večjo sliko" /><!-- END img -->
It works in IE and Firefox

This works PERFECTLY on IE. No need for the rest of the stuff, this is exactly what I was looking for. THANK YOU.

I altered it a bit for my own needs:

Code: Select all

<!-- BEGIN img --><img src="{URL}" alt="Image" title="Image" border="0" onload="if(this.width > 400) {this.width='400'; this.className='clickable'; }" onclick="if(this.width >= 400) { window.open('{URL}', '_blank'); return false; }" /><!-- END img -->

rickyboyce
Registered User
Posts: 17
Joined: Mon Sep 24, 2007 12:58 am
Contact:

Re: [2.0.11] Resize Posted Images Based on Max Width

Post by rickyboyce » Wed Sep 26, 2007 2:35 am

Please Help Someone!

rickyboyce
Registered User
Posts: 17
Joined: Mon Sep 24, 2007 12:58 am
Contact:

Re: [2.0.11] Resize Posted Images Based on Max Width

Post by rickyboyce » Fri Sep 28, 2007 10:27 am

Hey there Guys Don't worry! i figired out how to dissable the url, so it dosn't cause problems to over sized image links AKA Banners!!!!

Ok here is how i did it (if anyone is still roaming this thread lol) :)

OK open up your "rmw_jslib.js" file!

Now delete ALL the code in it!

Insert this instead!
/*

"Resize Posted Images Based on Max Width" 2.4.5
A phpBB MOD originally created by Christian Fecteau.

This MOD is copyright (c) Christian Fecteau 2004-2005

This MOD is released under the Creative Commons licence:
http://creativecommons.org/licenses/by-nc-sa/2.0/
Read carefully this licence before making any use of my code.

Credits must be given with my full name (Christian Fecteau)
and a link to my portfolio: http://portfolio.christianfecteau.com/

Removal or alteration of this notice is strongly prohibited.

*/

// don't change anything below

function rmw_go()
{
var rmw_img_array = document.getElementsByTagName("IMG");
for (var i = 0; i < rmw_img_array.length; i++)
{
var rmw_img = rmw_img_array;
if (String(rmw_img.getAttribute('resizemod')) == 'on')
{
if (rmw_wait_for_width && rmw_img.width && !isNaN(rmw_img.width))
{
if (rmw_img.width > Number(rmw_max_width))
{
rmw_img.setAttribute('resizemod','off');
rmw_img.onload = null;
rmw_img.removeAttribute('onload');
var rmw_clone = rmw_img.cloneNode(false);
var rmw_parent = rmw_img.parentNode;
rmw_clone.setAttribute('width',String(rmw_max_width));
rmw_parent.replaceChild(rmw_clone,rmw_img);
rmw_make_pop(rmw_clone);
}
}
else if (!rmw_wait_for_width)
{
rmw_img.setAttribute('resizemod','off');
var rmw_clone = rmw_img.cloneNode(false);
rmw_img.onload = null;
rmw_img.removeAttribute('onload');
var rmw_parent = rmw_img.parentNode;
var rmw_ind = rmw_count++;
rmw_clone.setAttribute('resizemod',String(rmw_ind));
rmw_preload[rmw_ind] = new Image();
rmw_preload[rmw_ind].src = rmw_img.src;
if (window.showModelessDialog)
{
rmw_clone.style.margin = '2px';
}
rmw_clone.style.border = rmw_border_1;
rmw_clone.style.width = '28px';
rmw_parent.replaceChild(rmw_clone,rmw_img);
}
}
}
if (!rmw_over && document.getElementById('resizemod'))
{
rmw_over = true;
rmw_go();
}
else if (!rmw_over)
{
window.setTimeout('rmw_go()',2000);
}
}
function rmw_img_loaded(rmw_obj)
{
if (!document.getElementsByTagName || !document.createElement) {return;}
var rmw_att = String(rmw_obj.getAttribute('resizemod'));
var rmw_real_width = false;
if ((rmw_att != 'on') && (rmw_att != 'off'))
{
var rmw_index = Number(rmw_att);
if (rmw_preload[rmw_index].width)
{
rmw_real_width = rmw_preload[rmw_index].width;
}
}
else
{
rmw_obj.setAttribute('resizemod','off');
if (rmw_obj.width)
{
rmw_real_width = rmw_obj.width;
}
}
if (!rmw_real_width || isNaN(rmw_real_width) || (rmw_real_width <= 0))
{
var rmw_rand1 = String(rmw_count++);
eval("rmw_retry" + rmw_rand1 + " = rmw_obj;");
eval("window.setTimeout('rmw_img_loaded(rmw_retry" + rmw_rand1 + ")',2000);");
return;
}
if (rmw_real_width > Number(rmw_max_width))
{
if (window.showModelessDialog)
{
rmw_obj.style.margin = '2px';
}
rmw_make_pop(rmw_obj);
}
else if (!rmw_wait_for_width)
{
rmw_obj.style.width = String(rmw_real_width) + 'px';
rmw_obj.style.border = '0';
if (window.showModelessDialog)
{
rmw_obj.style.margin = '0px';
}
}
if (window.ActiveXObject) // IE on Mac and Windows
{
window.clearTimeout(rmw_timer1);
rmw_timer1 = window.setTimeout('rmw_refresh_tables()',10000);
}
}
function rmw_refresh_tables()
{
var rmw_tables = document.getElementsByTagName("TABLE");
for (var j = 0; j < rmw_tables.length; j++)
{
rmw_tables[j].refresh();
}
}
function rmw_make_pop(rmw_ref)
{
rmw_ref.style.border = rmw_border_2;
rmw_ref.style.width = String(rmw_max_width) + 'px';
if (!window.opera)
{
rmw_ref.onclick = function()
{
/*if (!rmw_pop.closed)
{
rmw_pop.close();
}
rmw_pop = window.open('about:blank','christianfecteaudotcom',rmw_pop_features);
rmw_pop.resizeTo(window.screen.availWidth,window.screen.availHeight);
rmw_pop.moveTo(0,0);
rmw_pop.focus();
rmw_pop.location.href = this.src;*/
}
}
else
{
var rmw_rand2 = String(rmw_count++);
eval("rmw_pop" + rmw_rand2 + " = new Function(\"rmw_pop = window.open('" + rmw_ref.src + "','christianfecteaudotcom','" + rmw_pop_features + "'); if (rmw_pop) {rmw_pop.focus();}\")");
eval("rmw_ref.onclick = rmw_pop" + rmw_rand2 + ";");
}
/*document.all ? rmw_ref.style.cursor = 'hand' : rmw_ref.style.cursor = 'pointer';
rmw_ref.title = rmw_image_title;
if (window.showModelessDialog)
{
rmw_ref.style.margin = '0px';
}*/
}
if (document.getElementsByTagName && document.createElement) // W3C DOM browsers
{
rmw_preload = new Array();
if (window.GeckoActiveXObject || window.showModelessDialog) // Firefox, NN7.1+, and IE5+ for Win
{
rmw_wait_for_width = false;
}
else
{
rmw_wait_for_width = true;
}
rmw_pop_features = 'top=0,left=0,width=' + String(window.screen.width-80) + ',height=' + String(window.screen.height-190) + ',scrollbars=1,resizable=1';
rmw_over = false;
rmw_count = 1;
rmw_timer1 = null;
if (!window.opera)
{
rmw_pop = new Object();
rmw_pop.closed = true;
rmw_old_onunload = window.onunload;
window.onunload = function()
{
if (rmw_old_onunload)
{
rmw_old_onunload();
rmw_old_onunload = null;
}
if (!rmw_pop.closed)
{
rmw_pop.close();
}
}
}
window.setTimeout('rmw_go()',2000);
}


What i did was added these /**/ infront and behind both of these codes:

if (!rmw_pop.closed)
{
rmw_pop.close();
}
rmw_pop = window.open('about:blank','christianfecteaudotcom',rmw_pop_features);
rmw_pop.resizeTo(window.screen.availWidth,window.screen.availHeight);
rmw_pop.moveTo(0,0);
rmw_pop.focus();
rmw_pop.location.href = this.src;


and

document.all ? rmw_ref.style.cursor = 'hand' : rmw_ref.style.cursor = 'pointer';
rmw_ref.title = rmw_image_title;
if (window.showModelessDialog)
{
rmw_ref.style.margin = '0px';
}


as this dissables the link, link curser(hand) and the rollover"click to see full size image"!!!!!!
It only turns it into a comment as you can easily change the code back by deleting the quotes!!!!

Thanks, would be appricaited if you found this usefull!!! :D :D :D
Ricky!

rrjbeals
Registered User
Posts: 15
Joined: Fri Jul 13, 2007 7:02 pm

Re: [2.0.11] Resize Posted Images Based on Max Width

Post by rrjbeals » Tue Oct 02, 2007 1:44 pm

Hmm... I wonder if anyone can help. I've installed this mod manually, and rechecked everything. It works fine in Firefox, but not IE-6.

Here's the test page:
http://www.rjbeals.com/viewtopic.php?t=8

I get an invalid argument error warning in the bottom left of the page. I don't know javascript, but it may have to do with that? Thanks.

diabolic.bg
Registered User
Posts: 447
Joined: Mon Dec 11, 2006 3:41 pm
Location: Bulgaria, Sofia
Contact:

Re: [2.0.11] Resize Posted Images Based on Max Width

Post by diabolic.bg » Tue Oct 02, 2007 2:07 pm

The problem is in IE. Don't use it. :D In my board I redirect IE to Opera download... :lol:

Post Reply

Return to “[2.0.x] MOD Database Cleanup”

Who is online

Users browsing this forum: No registered users and 6 guests