Page 1 of 1

Auto resize [img] code

PostPosted: Wed Feb 14, 2007 4:39 pm
Author: xfx
Your phpBB Version: 2.0.22
phpBB Type: Integramod 141
MODs: No
Your knowledge: Beginner
Board URL: [url]http://[/url]

PHP Version:
MySQL Version:


What was done before the problem appeared?



What was done to try to solve the problem?




De.scription and Message

How do I set my forum to resize images from bbcode [img] to a default size like 640x480? when I use [img] to display an image from external server like imageshack, the image is displayed in the original size, so if the image is too big, my forum looks terrible after image show up.
hope someone can help me to fix this
tnks

Re: Auto resize [img] code

PostPosted: Wed Feb 14, 2007 4:52 pm
Author: xfx
I've solved...

PostPosted: Thu Feb 15, 2007 5:28 pm
Author: ayasha
how did you do this? i would like to be able to control the signatures to be no larger than 500 x 500 on my forum, and the images in post too

Re: Auto resize [img] code

PostPosted: Thu Feb 15, 2007 7:01 pm
Author: DjPorkchop
Yeah that would be sweet. I have a screenshots forum that I am having people upload too before I add them to a album for various reasons. Very much needed. I agree with Cleo. How did you work this out?

Re: Auto resize [img] code

PostPosted: Wed Feb 21, 2007 8:08 am
Author: xfx
#-----[ OPEN ]---------------------------------------------
#You should modify all the templates that you have.

template/integra2/bbcode.tpl

#
#-----[ FIND ]---------------------------------------------
#

<BEGIN><img><END>

#
#-----[ REPLACE WITH ]--------------------------------------
# you can change 800 value with the values you like... They are in pixels...

<BEGIN><img><END>

PostPosted: Thu Aug 09, 2007 11:20 pm
Author: Max Paint
You can also try this modification: (I removed HEIGHT for easier use.
Code: Select all
 ############################################################## ## MOD Title]http://www.robintown.nl[/url] ## MOD De.scription: With this mod you can set the weidth and height of an image via the BBcode ## MOD Version: 1.0.0## ## Installation Level: (Easy) ## Installation Time: 5 Minutes ## Files To Edit: bbcode.php, bbcode.tpl ## Included Files: (n/a)############################################################## ## For Security Purposes, Please Check: [url=http://www.phpbb.com/mods/]http://www.phpbb.com/mods/[/url] 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: [url=http://www.phpbb.com/mods/]http://www.phpbb.com/mods/[/url] ############################################################## ## Author Notes: ## My first 'real' mod <img>############################################################## ## MOD History: ## ## 2005-02-15 - Version 1.0.0 ## - release## ############################################################## ## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD ##############################################################  # #-----[ OPEN ]------------------------------------------ # includes/bbcode.php  # #-----[ FIND ]------------------------------------------ #     $bbcode_tpl['img'] = str_replace('{URL}', '\1', $bbcode_tpl['img']);  # #-----[ AFTER, ADD ]------------------------------------------ #     $bbcode_tpl['imgwh'] = str_replace('{URL}', '\2', $bbcode_tpl['imgwh']);     $bbcode_tpl['imgwh'] = str_replace('{WIDTH}', '\1', $bbcode_tpl['imgwh']);  # #-----[ FIND ]------------------------------------------ #     // matches a [url]xxxx://www.phpbb.com[/url] code..  # #-----[ BEFORE, ADD ]------------------------------------------ #     // [img width= height= ] and [/img] code..     $patterns[95] = "#[img width=([0-9]?[0-9]?[0-9]):$uid](.*?)[/img]#si";     $replacements[95] = $bbcode_tpl['imgwh'];  # #-----[ FIND ]------------------------------------------ #     // [flash=,:2e8cvjq5]image_url_here[/flash:2e8cvjq5] code..     $text = preg_replace("#[img]((http|ftp|https|ftps)://)([^ ?&=#"nrt<]*?(.(jpg|jpeg|gif|png)))[/img]#sie", "'[img]\1' . str_replace(' ', '%20', '\3') . '[/img]'", $text);  # #-----[ AFTER, ADD ]------------------------------------------ #     // [img width= heigth=] and [/img] code..     $text = preg_replace("#[img width=([0-9]?[0-9]?[0-9])](([a-z]+?)://([^, nr]+))[/img]#si","[img width=\1:$uid]\2[/img]", $text);  # #-----[ OPEN ]------------------------------------------ # templates/********/bbcode.tpl  # #-----[ FIND ]------------------------------------------ # <BEGIN><img><END>  # #-----[ AFTER, ADD ]------------------------------------------ # <BEGIN><img></img><END>  # #-----[ SAVE/CLOSE ALL FILES ]------------------------------------------ # # EoM  

Now you can add a simple [img width=mypx] to the post and the pic will resize, if you want it to.