[2.0.11] Resize Posted Images Based on Max Width

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

Rating:

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

spooky2280
Registered User
Posts: 142
Joined: Tue Jul 20, 2004 8:48 pm

Post by spooky2280 »

Only the js file has changed. Upload the new one. That's it. 8) Unless you have the Attachment MOD installed, there is now a contrib MOD file for this.

Code: Select all

##   2005-01-13 - Version 2.4.3
##      - Files with changes from 2.4.2 to 2.4.3:
##               - templates/rmw_jslib.js
##      - Now the popup window is maximized automatically, except in Opera
##      - Added a MOD file for the "File Attachment" MOD
spooky2280
Registered User
Posts: 142
Joined: Tue Jul 20, 2004 8:48 pm

Post by spooky2280 »

A minor bug with 2.4.3 has been reported. The fix only affects the js file and a new version of the file (2.4.4) has been uploaded to my server:
http://www.christianfecteau.com/phpBB2/ ... style=1#97

I'm submitting the new version right now.
User avatar
PCGUY112887
Registered User
Posts: 502
Joined: Thu Apr 01, 2004 12:39 am
Location: Illinois
Contact:

Post by PCGUY112887 »

Ah great mod!
I am using 2.4.5 right now (downloaded from your demo board), and I was hoping that you could take the time and make it so this mod also worked for <img> tags in posts and also resized attached images...
spooky2280
Registered User
Posts: 142
Joined: Tue Jul 20, 2004 8:48 pm

Post by spooky2280 »

For File Attachment MOD, it is included in the zip you downloaded:
http://www.christianfecteau.com/phpBB2/ ... ?p=101#101

You'll be happy to know that I'm working on a new more powerful MOD that will take care of the <img> :
http://www.phpbb.com/phpBB/viewtopic.php?t=256271
It's gonna be ready to beta test in a couple of days.
User avatar
PCGUY112887
Registered User
Posts: 502
Joined: Thu Apr 01, 2004 12:39 am
Location: Illinois
Contact:

Post by PCGUY112887 »

Ah thanks!
But I wanted this simple good mod to support <IMG>
Anyone else know how to add onto this script just adding <IMG> support?
spooky2280
Registered User
Posts: 142
Joined: Tue Jul 20, 2004 8:48 pm

Post by spooky2280 »

Code: Select all

##############################################################
## MOD Title:          Resize Posted Images with HTML tag
## MOD Author:         spooky2280 < [email protected] > (Christian Fecteau) http://portfolio.christianfecteau.com/
## MOD Description:    This MOD makes "Resize Posted Images Based on Max Width MOD" processes
##                     images posted with HTML <img> tag
##
## MOD Version:        1.0.1
##
## Installation Level: Easy
## Installation Time:  5 Minutes
##
## Files To Edit:      4
##      viewtopic.php
##      posting.php
##      includes/topic_review.php
##      privmsg.php
##
## Included Files:     none
##
##############################################################
## For Security Purposes, Please Check: http://www.phpbb.com/mods/ for the
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered
## in our MOD-Database, located at: http://www.phpbb.com/mods/
##############################################################
## Author Notes:
##
## If the user specifies the width and height attributes,
## the script might fail or behave abnormally. The script assumes
## that width and height won't be set on the IMG element.
## If the members of your board are used to specify the width
## and height attributes when they post images with HTML,
## it is recommended to not install this add-on to the MOD.
## Disable the IMG tag for allowed HTML in the ACP instead
## of making the modifications below.
##
##############################################################
## MOD History:
##
##   2005-01-19 - Version 1.0.1
##      - Fixed a OPEN
##
##   2005-01-19 - Version 1.0.0
##      - First release
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
#
#-----[ OPEN ]------------------------------------------
#
viewtopic.php
#
#-----[ FIND ]------------------------------------------
#
# around line 1136
#
$message = str_replace("\n", "\n<br />\n", $message);
#
#-----[ AFTER, ADD ]------------------------------------------
#
$message = str_replace('resizemod="on" onload="rmw_img_loaded(this)"','',$message);
$message = str_replace('<img','<img resizemod="on" onload="rmw_img_loaded(this)" ',$message);
#
#-----[ OPEN ]------------------------------------------
#
posting.php
#
#-----[ FIND ]------------------------------------------
#
# around line 699
#
$preview_message = str_replace("\n", '<br />', $preview_message);
#
#-----[ AFTER, ADD ]------------------------------------------
#
$preview_message = str_replace('resizemod="on" onload="rmw_img_loaded(this)"','',$preview_message);
$preview_message = str_replace('<img','<img resizemod="on" onload="rmw_img_loaded(this)" ',$preview_message);
#
#-----[ OPEN ]------------------------------------------
#
includes/topic_review.php
#
#-----[ FIND ]------------------------------------------
#
# around line 181
#
$message = str_replace("\n", '<br />', $message);
#
#-----[ AFTER, ADD ]------------------------------------------
#
$message = str_replace('resizemod="on" onload="rmw_img_loaded(this)"','',$message);
$message = str_replace('<img','<img resizemod="on" onload="rmw_img_loaded(this)" ',$message);
#
#-----[ OPEN ]------------------------------------------
#
privmsg.php
#
#-----[ FIND ]------------------------------------------
#
# around line 611
#
$private_message = str_replace("\n", '<br />', $private_message);
#
#-----[ AFTER, ADD ]------------------------------------------
#
$private_message = str_replace('resizemod="on" onload="rmw_img_loaded(this)"','',$private_message);
$private_message = str_replace('<img','<img resizemod="on" onload="rmw_img_loaded(this)" ',$private_message);
#
#-----[ FIND ]------------------------------------------
#
# around line 1570
#
$preview_message = str_replace("\n", '<br />', $preview_message);
#
#-----[ AFTER, ADD ]------------------------------------------
#
$preview_message = str_replace('resizemod="on" onload="rmw_img_loaded(this)"','',$preview_message);
$preview_message = str_replace('<img','<img resizemod="on" onload="rmw_img_loaded(this)" ',$preview_message);
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM
Last edited by spooky2280 on Wed Jan 19, 2005 11:02 pm, edited 3 times in total.
User avatar
PCGUY112887
Registered User
Posts: 502
Joined: Thu Apr 01, 2004 12:39 am
Location: Illinois
Contact:

Post by PCGUY112887 »

Please don't tell me you wrote that just for me :p
But I stuck it in a folder and droped it in my mods folder for easymod and I get....
Critical Error

Function Trace: open_files[5]->modio_open[1]

Could not open [topic_review.php] for reading.
MOD script line #77 :: FAQ :: Report


Edit - yay I made it work!

#-----[ OPEN ]------------------------------------------
#
topic_review.php

Should be

#-----[ OPEN ]------------------------------------------
#
includes/topic_review.php

Now it works :)
DUDE YOU ROCK!
Thanks :D
spooky2280
Registered User
Posts: 142
Joined: Tue Jul 20, 2004 8:48 pm

Post by spooky2280 »

Sorry I wrote it in one shot and didn't test it. I can't believe there was only one mistake! ;) You did read the Author Notes, right? I don't recommend these modifications to the MOD because members can screw up the MOD by specifying a width and height attributes. I could remove them, but what would be the point then to allow HTML for images? I mean what else than for the width and height attributes do you allow the <img> HTML tag?
User avatar
PCGUY112887
Registered User
Posts: 502
Joined: Thu Apr 01, 2004 12:39 am
Location: Illinois
Contact:

Post by PCGUY112887 »

The reason is because many of my users come from another forum, which uses Snitz forums, and everyone has gotten used to using <img> tags. I tried to have them learn BBcode but they resist after years of full HTML allowed on their previous forums :p

So I allow limited HTML and BBcode so old members will be OK and new people that know how to use phpBB will use BBcode.

Only a few of them would know how to set height and width anyways.... and if they do i'll just edit the post or a mod will.

Thanks for making that up for me :)
spooky2280
Registered User
Posts: 142
Joined: Tue Jul 20, 2004 8:48 pm

Post by spooky2280 »

PCGUY112887 wrote: [...] everyone has gotten used to using <img> tags. I tried to have them learn BBcode but they resist after years of full HTML allowed on their previous forums :p

That makes sense. I used to run a board for non "computer litterate" people. I got so sick of telling them how to use BBCode that I shut down the board. 8O Now I'm only coding MODs and I'm happy. :)
jupro
Registered User
Posts: 273
Joined: Sat Jun 12, 2004 8:26 am

older browser issues

Post by jupro »

Hi there,

Sorry if this is a dumb question, but what happens if this mod is installed and a user is using an older browser?

Thanks very much.
spooky2280
Registered User
Posts: 142
Joined: Tue Jul 20, 2004 8:48 pm

Post by spooky2280 »

Nothing happens. The layout is like as if there was no MOD. And no javascript error is supposed to be generated if it's an old javascript browser like NN3 or NN4 or IE4. Nobody creates for these browsers anymore. The oldest browsers still considered when coding are IE5 and NN6 and the MOD works in these browser.
jupro
Registered User
Posts: 273
Joined: Sat Jun 12, 2004 8:26 am

Thanks

Post by jupro »

thanks a lot.
User avatar
Smokeydogg
Registered User
Posts: 240
Joined: Sat Dec 06, 2003 8:02 am
Contact:

Post by Smokeydogg »

i added it and it dont work so i took it off

these resize mods have never worked on my site
spooky2280
Registered User
Posts: 142
Joined: Tue Jul 20, 2004 8:48 pm

Post by spooky2280 »

What's your site?
Post Reply

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