Widescreen Gaming Forum http://www.wsgf.org/phpBB3/ |
|
Resize photos automatically http://www.wsgf.org/phpBB3/viewtopic.php?f=59&t=14716 |
Page 1 of 4 |
Author: | Ryom [ 18 Jun 2007, 22:17 ] |
Post subject: | Resize photos automatically |
Since this is a recurring issue, add the attachment mod with a max image size before being linkified, or add one of the client side javascript mods that resize embedded photos to fit the browser window. Client side resize is a 10 minute mod and allows images to match the viewers resolution instead of simply guessing what the max should be. Someone is always going to come along with 640x480 res and think the standard is too big, and someone with 2560x1600 res thinks they are too small. Client side resize for the win! |
Author: | Ryom [ 19 Jun 2007, 06:55 ] |
Post subject: | Resize photos automatically |
http://www.phpbb.com/community/viewtopic.php?t=123690 - Simple Image Resize 1.10 - Installation time: 1 minute - Installation Level - Easy Code: #################################################################
## Mod Title: Simple Image Resize ## Mod Version: 1.1.0 Final ## Author: likeatim < admin @ essential-freebies.de > < http://www.efb.nu > ## Description: ## Orginal Code by opa @ invisionpower.de ## This adds a simple Image resize code so your tables won't get screwed by oversized images. ## Works dynamically with every screen resolution. ## Uses Javascript, so resizing might not work if people have adblocker (Proxomitron etc.) installed. ## Solution: Users should then add your site to their trusted sites within the adblocker. ## ## Installation Level: Easy ## Installation Time: 1 Minute ## Files To Edit: bb.code.tpl ## Included Files: n/a ################################################################# ## Security Disclaimer: This MOD Cannot Be Posted To Or Added At Any Non-Official phpBB Sites ################################################################# ## ## Author Note: ## No Notes. ## ## History: ## 1.10: Images now are resized proportionally (as an alternative) ## 1.00: Initial Release ## ## the phpBB Group Reserves The Right To Remove/Edit Author Notes, ## Should It Be Warranted ## ################################################################# ## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD ################################################################# # #-----[ OPEN ]------------------------------------------ # templates/subsilver (or whatever you use/bbcode.tpl # #-----[ FIND ]------------------------------------------ # <!-- BEGIN img --><img src="{URL}" border="0" /><!-- END img --> # #-----[ REPLACE WITH ]------------------------------------------ # <!-- BEGIN img --><img src='{URL}' border='0' onload="javascript:if(this.width > screen.width-300)this.width = (screen.width-300)" onclick="javascript:window.open('{URL}','','scrollbars=1,toolbar=yes,resizable=1,menubar=yes,directories=yes,status=yes')" alt="Posted Image, might have been reduced in size. Click Image to view fullscreen." title="Posted Image, might have been reduced in size. Click Image to view fullscreen." /> <!-- END img --> FOR PROPORTIANAL RESIZING: # #-----[ REPLACE WITH ]------------------------------------------ # <!-- BEGIN img --><img src='{URL}' border='0' onload="javascript:if(this.width > screen.width-300){ this.height = Math.round(((screen.width-300)/this.width)*this.height); this.width = (screen.width-300); }" onclick="javascript:window.open('{URL}','','scrollbars=1,toolbar=0,resizable=1,menubar=0,directories=0,status=0')" alt="Posted Image, might have been reduced in size. Click Image to view fullscreen." title="Posted Image, might have been reduced in size. Click Image to view fullscreen." /> <!-- END img --> # #-----[ SAVE/CLOSE ALL FILES ]------------------------------------------ # # EoM |
Author: | ctrlsteef [ 19 Jun 2007, 07:37 ] |
Post subject: | Resize photos automatically |
Lol, another thing we talked about many times with the difference that we now actually have something easy to implement. :) It's all up to Ibrin. |
Author: | Paradigm Shifter [ 19 Jun 2007, 09:57 ] |
Post subject: | Resize photos automatically |
It's more a matter of the mods conflicting with tweaks that are already made to the underlying phpBB code used on the WSGF. It might work without issues, but I don't know for sure. |
Author: | skipclarke [ 19 Jun 2007, 14:34 ] |
Post subject: | Resize photos automatically |
I tried it this morning, but it didn't resize the pics. I did get the "Posted Image, might have been reduced in size. Click Image to view fullscreen." text when I moused-over, so I know the code took. But, it didn't resize in Safari or FireFox. |
Author: | NightBlade [ 19 Jun 2007, 16:27 ] |
Post subject: | Resize photos automatically |
The Javascript code seems to open up a new window with the full sized image, maybe your popup blocker is being overzealous? To do inline resizing, you might have something like this (keep in mind I don't really work with Javascript, so this code might not be perfect): Code: <!-- BEGIN img --><img src='{URL}' border='0' onload="javascript:origwidth = this.width; origheight = this.height; if(this.width > screen.width-300){ this.height = Math.round(((screen.width-300)/this.width)*this.height); this.width = (screen.width-300); }" onclick="this.width = origwidth; this.height = origheight;" alt="Posted Image, might have been reduced in size. Click Image to view fullscreen." title="Posted Image, might have been reduced in size. Click Image to view fullscreen." />
<!-- END img --> |
Author: | skipclarke [ 19 Jun 2007, 17:38 ] |
Post subject: | Resize photos automatically |
It would open the "full size" image in the new window. The issue is that it didn't to the inline re-size. Will try this one later. |
Author: | NightBlade [ 20 Jun 2007, 10:41 ] |
Post subject: | Resize photos automatically |
My previous example does work, but it would only go from the scaled size to the full size. I've reworked it so that if you click it multiple times, it toggles between the scaled size and the full size :D If you want it to scale it smaller, increase the last two "300" values. Code: <img src='{URL}' border='0' onload="javascript:this.origwidth = this.width; this.origheight = this.height; this.resized = 0; if(this.width > screen.width-300){ this.height = Math.round(((screen.width-300)/this.width)*this.height); this.width = (screen.width-300); this.resized = 1;} this.scaledheight = this.height; this.scaledwidth = this.width;" onclick="if(this.resized){this.width = this.origwidth; this.height = this.origheight; this.resized = 0;} else {this.width = this.scaledwidth; this.height = this.scaledheight; this.resized = 1;}" alt="Posted Image, might have been reduced in size. Click Image to view fullscreen." title="Posted Image, might have been reduced in size. Click Image to view fullscreen." />
|
Author: | Ryom [ 22 Jun 2007, 08:39 ] |
Post subject: | Resize photos automatically |
Any luck? |
Author: | skipclarke [ 22 Jun 2007, 19:43 ] |
Post subject: | Resize photos automatically |
Just tried it, and no go. Must be some way that phpBB is handling the code. I do get the new alt txt when I mouse-over, but no resize. |
Page 1 of 4 | All times are UTC [ DST ] |
Powered by phpBB® Forum Software © phpBB Group http://www.phpbb.com/ |