[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

SweetLou
Registered User
Posts: 180
Joined: Thu Dec 23, 2004 2:49 am

Post by SweetLou » Sun Feb 27, 2005 12:08 am

Great mod, but I'm having a bit of trouble. I have version 2.4.5 of this mod running on phpbb 2.0.12. I have this mod installed on four styles: subSilver, Helius, SoftBlue and myApple. The mod works great on subSilver and Helius. It doesn't resize the images in SoftBlue and myApple.
I installed this mod by hand. I have installed it a couple of times, with fresh installs of phpbb. I just can't figure why it won't work on those two styles. Any ideas?

Edit: Ok, nevermind. I think I found my problem in SoftBlue and I probably made the same mistake in myApple. I think I put the code for overall_headler.tpl inside of a switch instead of before.

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

Post by spooky2280 » Sun Feb 27, 2005 12:18 am

This MOD works whatever the style is. And SoftBlue works fine on the demo board:
http://www.christianfecteau.com/phpBB2/ ... 11&style=8
Post a link to the source code where you said it didn't work. Or save the page as Complete Web Page, zip the files, put the zip on your server and mail me the link to the zip.

SweetLou
Registered User
Posts: 180
Joined: Thu Dec 23, 2004 2:49 am

Post by SweetLou » Sun Feb 27, 2005 2:15 am

Thanks for the help. I guess you didn't catch my edit of the post. I found the problem and fixed it. I guess I kept making the same mistake a bunch of times. MyApple was an outdated style. I found a newer version and was able to fix the problem. Now, I just have to figure out why the image pushes the buttons, the edit, delete, quote, etc, in the post to the end of the image, yet text does not do this. I think I saw something in this thread about image size not being the real image size. I will have to find that and see what I can do.

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

Post by spooky2280 » Sun Feb 27, 2005 2:25 am

Cryomenace and SweetLou read this this post:
http://www.phpbb.com/phpBB/viewtopic.ph ... 91#1385091

It may be possible to fix this invisible gap by detecting IE and setting a negative right and left margin of -150%. But the other MOD that I made:
http://www.phpbb.com/phpBB/viewtopic.php?t=263135
is so much better for resizing images that I don't feel like working on this one anymore. The other one doesn't have any invisible gap problem in IE.

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

Post by spooky2280 » Mon Feb 28, 2005 3:27 am

BigDaddy96 and Fr0zen, the File Attachment MOD has a thumbnail feature for images:
http://www.opentools.de/docs/user_guide.html#howthumbs

If you want to make thumbnails for offsite images posted with BBCode, you should look into these server-side MODs:
http://www.phpbb.com/phpBB/viewtopic.php?t=224522
http://smartor.is-root.com/viewtopic.php?t=3021

The first one will show you how to get the size of offsite images and the second one will show you how to make a thumbnail out of them with the GD library. The source code of the File Attachment MOD can also teach you how to make thumbnails with the GD library.

You can also look up the source code of Gallery:
http://gallery.sourceforge.net/
You will learn everything you need in there.

SweetLou
Registered User
Posts: 180
Joined: Thu Dec 23, 2004 2:49 am

Post by SweetLou » Mon Feb 28, 2005 7:06 am

Thanks again spooky for all your help and the mod. I've actually been playing around with tables in viewtopic_body.tpl in the affected styles. I'm getting it pretty close to how I want it. I know about those other mods, but I like this one the best. The limit image width is pretty good, but if you have a lot of images in a thread, it can become very slow. Your other one is nice, but I didn't want all that functionality. I might give it a try though.

BigDaddy96
Registered User
Posts: 7
Joined: Sun Jan 16, 2005 6:59 pm

Post by BigDaddy96 » Mon Feb 28, 2005 1:53 pm

spooky2280 wrote: BigDaddy96 and Fr0zen, the File Attachment MOD has a thumbnail feature for images:
http://www.opentools.de/docs/user_guide.html#howthumbs

If you want to make thumbnails for offsite images posted with BBCode, you should look into these server-side MODs:
http://www.phpbb.com/phpBB/viewtopic.php?t=224522
http://smartor.is-root.com/viewtopic.php?t=3021

The first one will show you how to get the size of offsite images and the second one will show you how to make a thumbnail out of them with the GD library. The source code of the File Attachment MOD can also teach you how to make thumbnails with the GD library.

You can also look up the source code of Gallery:
http://gallery.sourceforge.net/
You will learn everything you need in there.


Thanks spooky, I was just looking at the doc for the attach mod last night. You can force it to always do thumbs and display them using Imagick - I tested it last night and it works well. This is just what Fr0zen wanted. You can also have it use GD and I was wondering if I could find the code in there to resize and display everything at 640x480 or something like that. :)

Cryomenace
Registered User
Posts: 22
Joined: Wed Jan 19, 2005 11:33 am
Location: Taastrup, Denmark

Post by Cryomenace » Mon Feb 28, 2005 2:56 pm

spooky2280 wrote: Cryomenace and SweetLou read this this post:

I uninstalled this Mod and installed your "mw3 (Prevent Any Layout From Being Broken)".

Thanks for your help, everything works like a charm. If you were a girl, I would definitely have to kiss you. :P ;)
/Cryomenace

Apache/2.2.2 (Win32) mod_ssl/2.2.2 OpenSSL/0.9.8b PHP/5.1.4 MySQL/5.0.20 phpBB/2.0.21 Server at Port 443
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.4) Gecko/20060508 Firefox/1.5.0.4

danko
Registered User
Posts: 25
Joined: Wed Dec 24, 2003 8:16 am

Post by danko » Mon Feb 28, 2005 11:06 pm

You could make the image-width depend on the screen resolution of the client by changing this:

Code: Select all

#
#-----[ FIND ]------------------------------------------
#
<!-- start mod : Resize Posted Images Based on Max Width -->
<script type="text/javascript">
//<![CDATA[
<!--

var rmw_max_width = 600; // 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}';

//-->
//]]>
</script>
<!-- fin mod : Resize Posted Images Based on Max Width -->



#
#-----[ REPLACE WITH ]------------------------------------------
#
<!-- start mod : Resize Posted Images Based on Max Width -->
<script type="text/javascript">
//<![CDATA[
<!--
if (window.screen && window.screen.width) 
{ 
   var rmw_max_width = window.screen.width - 250; // you can change this number, this is the max width in pixels for posted images
} 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}';

//-->
//]]>
</script>
<!-- fin mod : Resize Posted Images Based on Max Width -->
Now it checks the screen-resolution-width and makes the image 250 pixels smaller. Thats in my case enough but you could change it.
Last edited by danko on Tue Mar 01, 2005 8:12 pm, edited 1 time in total.

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

Post by spooky2280 » Mon Feb 28, 2005 11:23 pm

You don't need to detect non W3C DOM browsers. The MOD works only with W3C DOM browsers and thus you only need window.screen.width:
http://www.phpbb.com/phpBB/viewtopic.ph ... 91#1385091

Code: Select all

if (window.screen && window.screen.width)
{
	var rmw_max_width = window.screen.width - 250;
}

User avatar
stanleyb23
Registered User
Posts: 42
Joined: Tue Jul 27, 2004 2:12 pm

mod doesnt work

Post by stanleyb23 » Wed Mar 02, 2005 12:25 am

Pls help,
cant find what im doing wrong
im getting a yellow triangle with a mistake in rule 136

this my code
Last edited by stanleyb23 on Wed Mar 02, 2005 1:30 am, edited 1 time in total.

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

Post by spooky2280 » Wed Mar 02, 2005 1:22 am

Read this post:
http://www.phpbb.com/phpBB/viewtopic.ph ... 13#1392913
and please remove your code to make the topic easier to read.

User avatar
stanleyb23
Registered User
Posts: 42
Joined: Tue Jul 27, 2004 2:12 pm

#%$%^

Post by stanleyb23 » Wed Mar 02, 2005 1:38 am

Still i dont get it..
I must say that i am finding changes everywhere.. but how on earth can i find what works for me..

I think i will forget it. I just removed it and installed the other mod;Any Layout From Being Broken, that doesnt work for me either cause the layout is getting wider. I have space around the forum and its using the space now to show the picture.

The picture mod was the solution for me, worked with firefox but doesnt work with ie6 to bad

goodluck all

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

Post by spooky2280 » Wed Mar 02, 2005 1:58 am

You give up too fast but I don't blame you: I myself give up easily on everything in life... except on coding. :?

Your "Good Luck All" makes your post look like a letter of suicide... :lol:
Jerry Seinfeld wrote: The thing I don't understand about the suicide person is the people who try to commit suicide, for some reason they don't die, and that's it. They stop trying. Why don't they just keep trying? What's changed? Is their life any better now? No. In fact, it's worse, because now they've found out here's one more thing you stink at. And that's why these people don't succeed at life to begin with. They give up too easy. I say, pills don't work? Try a rope. Car won't start in the garage? Get a tune-up. There's nothing more rewarding that reaching a goal you've set for yourself.


Your board is outputting a blank value for {T_BODY_LINK}
Simply hardcode it.

Instead of posting your code, do this:
http://www.phpbb.com/phpBB/viewtopic.ph ... 16#1450316

SweetLou
Registered User
Posts: 180
Joined: Thu Dec 23, 2004 2:49 am

Post by SweetLou » Wed Mar 16, 2005 8:32 pm

I messed around with the tables to get the image to go all the way over to the end of message box instead of just to where the buttons for edit, delete, IP, start. After a bit of trial and error I think I found a way.
I replaced in subSilver/viewtopic_body.tpl:

Code: Select all

	Removed due to problem with long subject titles. 
with:

Code: Select all

Removed due to a problem with long subject titles. Will replace when I discover a fix.
I have a little test forum for just this. You can see the image resize in action at removed until fixed.
Last edited by SweetLou on Wed Mar 16, 2005 9:51 pm, edited 1 time in total.

Post Reply

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