[MOD] Maximum Resim Boyutunu Belirlemek

[url=http://www.phpbbturkey.com/mods.html:34cnv4ga]phpBB 2.0.x MOD Veritabanımızda[/url:34cnv4ga] yayınlanan ve tarafınızca eklenen tüm yeni phpBB 2.0.x sürümleri için MODların duyuruları buradan yapılmaktadır. MODlar hakkında ihtiyacınız olan desteği lütfen [b:34cnv4ga]2.0.x MOD Destek[/b:34cnv4ga] forumuna başlık açarak sorunuz.
Kullanıcı avatarı
Mirach
Destek Ekibi Lideri
Destek Ekibi Lideri
Mesajlar: 1664
Kayıt: 27.03.2006, 01:06
Konum: İstanbul

[MOD] Maximum Resim Boyutunu Belirlemek

Mesaj gönderen Mirach »

Kod: Tümünü seç

############################################################## 
## MOD Title: Post Image Size
## MOD Author: Swizec < swizec@swizec.com > (N/A) http://www.swizec.com
## MOD Description: Admin can set the maximum display size of images displayed in posts. Images bigger than that are shrunk and turned into a link to the normal sized version.
## MOD Version: 1.2.7
## 
## Installation Level: Easy
## Installation Time: ~3 Minutes 
## Files To Edit: 
##		  includes/bbcode.php
##		  admin/admin_board.php
##		  templates/subSilver/bbcode.tpl
##		  templates/subSilver/admin/board_config_body.tpl
##		  language/lang_english/lang_main.php
##		  language/lang_english/lang_admin.php
## Included Files: N/A
##
## License: http://AÇsource.org/licenses/gpl-license.php GNU General Public License v2
############################################################## 
## For security purposes, please check: http://www.phpbb.com/mods/ 
## for the latest version of this MOD. Although MODs are checked 
## before being allowed in the MODs Database there is no guarantee 
## that there are no security problems within the MOD. No support 
## will be given for MODs not found within the MODs Database which 
## can be found at http://www.phpbb.com/mods/
############################################################## 
## Author Notes: 
##
## demo board: http://www.swizec.com/forum
## 
############################################################## 
## MOD History: 
## 
## 2005-04-17 - Version 1.0.0
##    - working mod
##
## 2005-04-17 - Version 1.0.1
##    - oops, small bug in the .mod file
##
## 2005-04-17 - Version 1.0.2
##    - omg I'm so fucken hasty
##
## 2005-05-01 - Version 1.0.3
##    - fixed a bug
##
## 2005-05-01 - Version 1.0.4
##    - some slashes got left behind
##
## 2005-05-02 - Version 1.0.5
##    - added "this is thumbnail" notice wished by MaddoxX
##
## 2005-05-24 - Version 1.0.6
##	- use of bbcode.tpl added
##
## 2005-05-31 - Version 1.0.7
##	- getting closer :)
##
## 2005-05-31 - Version 1.1.0
##	-fixed a bug
##	-implemented image aligning by pichirichi
##
## 2005-06-23 - Version 1.1.1
##	- fixed XHTML compliancy
##
## 2005-11-05 - Version 1.1.2
##	- fixed for 2.0.18
##
## 2005-11-11 - Version 1.1.3
##	- forgot to change the license and security warning before
##
## 2005-11-23 - Version 1.1.4
##	- small mistake in the HTML
##
## 2005-12-09 - Version 1.2.0
##	- fixed some "pretty" issues
##	- fixed slow load issue as best I could
##	- and an issue with left, right, center stuff
##
## 2005-12-17 - Version 1.2.1
##	- some minor HTML fixes
##	- parsing of "old" images and those that were not getimagesized properly
##
## 2005-12-17 - Version 1.2.2
##	- ok, now parsing of "old" images does actually work :)
##
## 2005-12-17 - Version 1.2.3
##	- some people really take care to report bugs O.o how nice of them
##
## 2005-12-21 - Version 1.2.4
##	- changes to the template were not pretty
##
## 2005-12-25 - Version 1.2.5
##	- there was a bug with small images
##
## 2006-01-01 - Version 1.2.6
##	- coding standards :P
##
## 2006-01-04 - Version 1.2.7
##	- even more coding standards :D
## 
############################################################## 
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD 
############################################################## 

# 
#-----[ SQL SORGUSU ]------------------------------------------ 
# 

INSERT INTO phpbb_config( config_name, config_value ) VALUES ( 'postimg_width', '800' );
INSERT INTO phpbb_config( config_name, config_value ) VALUES ( 'postimg_height', '600' );

# 
#-----[ AÇ ]------------------------------------------ 
# 

includes/bbcode.php

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

$bbcode_tpl = null;

# 
#-----[ SONRASINA EKLE ]------------------------------------------ 
# 

// mod img size add
function makeimgsize ( $width, $height ) 
{
	global $board_config;
	
	$size = '';
	
	// check for smallness
	if ( $width < $board_config['postimg_width'] && $height < $board_config['postimg_height'] )
	{
		return 'SMALL';
	}
	elseif ( $width > $height ) 
	{
		if ( $board_config['postimg_width'] < $width )
		{
			$size = 'width="' . $board_config['postimg_width'] . '"';
		}
	}else
	{
		if ( $board_config['postimg_height'] < $height )
		{
			$size = 'height="' . $board_config['postimg_height'] . '"';
		}
	}
	
	return $size;
}

function image_parse ( $post, $uid ) 
{
	global $board_config, $lang, $bbcode_tpl;

	preg_match_all( "/\[img(.*?):$uid\](.*?)\[\/img:$uid\]/i", $post, $matches);
	foreach ( $matches[0] as $i => $img ) 
	{ 
		$stuff = $matches[1][$i];
		$stuff = explode( ':', $stuff );
		if ( count( $stuff ) != 4 )
		{ // old image or something
			$post = preg_replace( "#\[img:$uid\]([^?].*?)\[/img:$uid\]#i", $bbcode_tpl['img'], $post );
		}
		switch($stuff[0]) 
		{
			case '=right': 
				$align = $lang['RIGHT']; 
				break;
			case '=center':
				$align = 'center';
				break;
			case '=left':
        		default: 
				$align = $lang['LEFT']; 
			break; 
		}
		$width = $stuff[1];
		$height = $stuff[2];
		$size = makeimgsize( $width, $height );
		
		if ( $size != 'SMALL' )
		{
			$replace = $bbcode_tpl['thmbimg'];
			$seek = array( '{IMAGE}', '{WIDTH}', '{HEIGHT}', '{SIZE}', '{NOTICE}', '{ALIGN}' );
			$with = ( !empty( $size ) ) ? array( $matches[2][$i] , $width, $height, $size, $lang['postimg_clickme'], $align ) : array( $matches[2][$i] , $width, $height, $size, '', $align );
			$replace = str_replace( $seek, $with, $replace );
		}
		else
		{
			$replace = str_replace( '\1', $matches[2][$i], $bbcode_tpl['img'] );
		}
		$post = str_replace( $img, $replace, $post );
	}
		
	return $post;
}
// mod img size end

# 
#-----[ BUL ]------------------------------------------ 
# 

$patterns[] = "#\[img:$uid\]([^?].*?)\[/img:$uid\]#i";

# 
#-----[ ÖNCESİNE EKLE ]------------------------------------------ 
# 

// mod img size replace with call to image parsing function
$text = image_parse ( $text, $uid );

# 
#-----[ BUL ]------------------------------------------ 
# 

$text = preg_replace("#\[img\]

# 
#-----[ ÖNCESİNE EKLE ]------------------------------------------ 
# 

	// mod max img size changed the first pass thingo
	preg_match_all( "#\[(img.*?)\]((http|ftp|https|ftps)://)([^ \?&=\#\"\n\r\t<]*?(\.(jpg|jpeg|gif|png)))\[/img\]#sie", $text, $matches );
	// now we go through these matches and do what's needed
	foreach ( $matches[0] as $i => $m )
	{
		// easier use
		$tag = $matches[1][$i];
		$url1 = $matches[2][$i];
		$url2 = $matches[4][$i];
		
		// if we already tagged this one then we leave it be ;)
		preg_match( '#img.*?:(\d+):(\d+)#i', $tag, $match );
		if ( empty( $match ) )
		{
			// get the size so we can store it
			if ( !$size = @getimagesize( $url1 . $url2 ) )
			{ // image will not get resized
				$width = '';
				$height = '';
			}
			else
			{
				$width = $size[0];
				$height = $size[1];
			}
		}
		else
		{ // we already have the size
			$width = $match[1];
			$height = $match[2];
		}
		$tag = explode( ':', $tag ); // remove any possible left over : stuff
		$tag = $tag[0];
		// lastly we replace it within the text
		$text = str_replace( $m, '[' . $tag . ':' . $width . ':' . $height . ':' . $uid . ']' . $url1 . $url2 . '[/img:' . $uid . ']', $text );
	}

# 
#-----[ IN-LINE BUL ]------------------------------------------ 
# 

$text

# 
#-----[ IN-LINE ÖNCESİNE EKLE ]------------------------------------------ 
# 

//

# 
#-----[ SONRASINA EKLE ]------------------------------------------ 
# 

// end mod img size changes

# 
#-----[ AÇ ]------------------------------------------ 
# 

admin/admin_board.php

# 
#-----[ BUL ]------------------------------------------ 
# 

$namechange_no = ( !$new['allow_namechange'] ) ? "checked=\"checked\"" : "";

# 
#-----[ SONRASINA EKLE ]------------------------------------------ 
# 

// mod img size add
$postimg_width = $new['postimg_width'];
$postimg_height = $new['postimg_height'];
// mod img size end

# 
#-----[ BUL ]------------------------------------------ 
# 

"L_RESET" => $lang['Reset'], 

# 
#-----[ SONRASINA EKLE ]------------------------------------------ 
# 

// mod img size add
"L_POSTIMG_SIZE" => $lang['postimg_size'],
"POSTIMG_WIDTH" => $postimg_width,
"POSTIMG_HEIGHT" => $postimg_height,
// mod img size end

# 
#-----[ AÇ ]------------------------------------------ 
# 

templates/subSilver/bbcode.tpl

# 
#-----[ BUL ]------------------------------------------ 
# 

<!-- END email -->

# 
#-----[ SONRASINA EKLE ]------------------------------------------ 
# 

<!-- BEGIN thmbimg -->
<div align="{ALIGN}">
 <table border="0">
  <tr>
   <td><img src="{IMAGE}" align="center" border="0" {SIZE}  onclick="window.open( '{IMAGE}', 'imgpop',  'width={WIDTH},height={HEIGHT},status=no,toolbar=no,menubar=no' );return false" /></td>
  </tr>
  <tr>
   <td align="center" class="gensmall"><i>{NOTICE}</i></td>
  </tr>
 </table>
</div>
<!-- END thmbimg -->

# 
#-----[ AÇ ]------------------------------------------ 
# 

templates/subSilver/admin/board_config_body.tpl

# 
#-----[ BUL ]------------------------------------------ 
# 

	<tr>
		<td class="row1">{L_ENABLE_PRUNE}</td>
		<td class="row2"><input type="radio" name="prune_enable" value="1" {PRUNE_YES} /> {L_YES}&nbsp;&nbsp;<input type="radio" name="prune_enable" value="0" {PRUNE_NO} /> {L_NO}</td>
	</tr>
	
# 
#-----[ SONRASINA EKLE ]------------------------------------------ 
# 

	<tr>
		<td class="row1">{L_POSTIMG_SIZE}</td>
		<td class="row2"><input type="text" size="5" maxlength="5" name="postimg_width" value="{POSTIMG_WIDTH}" /> X <input type="text" size="5" maxlength="5" name="postimg_height" value="{POSTIMG_HEIGHT}" /></td>
	</tr>

# 
#-----[ AÇ ]------------------------------------------ 
# 

language/lang_english/lang_main.php

# 
#-----[ BUL ]------------------------------------------ 
# 

?>

# 
#-----[ ÖNCESİNE EKLE ]------------------------------------------ 
# 

// mod img size add
$lang['postimg_clickme'] = 'Büyültmek için Tıkla';
	
# 
#-----[ AÇ ]------------------------------------------ 
# 

language/lang_english/lang_admin.php

# 
#-----[ BUL ]------------------------------------------ 
# 

?>

# 
#-----[ ÖNCESİNE EKLE ]------------------------------------------ 
# 

// mod img size add
$lang['postimg_size'] = 'Yazıdaki maximum resim boyutu';

# 
#-----[ TÜM DOSYALARI KAYDET/ÇIK ]------------------------------------------ 
# 
# EoM
En son Mirach tarafından 01.04.2006, 17:25 tarihinde düzenlendi, toplamda 1 kere düzenlendi.
Profilinde phpBB forumunun adresini girmemiş üyelere ve kurallara aykırı şekilde açılmış başlıklara destek verilmez.
Resim Resim Resim
Kullanıcı avatarı
CaN_BaKıR
Kayıtlı Kullanıcı
Mesajlar: 459
Kayıt: 17.03.2006, 01:16

Mesaj gönderen CaN_BaKıR »

Hocam bu maximum resim boyutu olayı hangisi?

Şimdi mesela ben bir tane gördüm resim boyutu uygun değil diyor ve küçültüp yeniden eklememizi istiyordu...

Bir başka forumda da hangi boyutlarda resim yüklenirse yüklensin otomatik olarak foruma sığdırdığını(belirlenen ölçüde) ve tıklayınca büyük halini gösterdiğini gördüm...

Bu mod hangisi? İkincisi ise çok iyi olur aslında :)
[ resmi görüntülemek için tıklayın ]
phpBB Nasıl Kurulur
https://www.phpbbturkey.com/viewtopic.php?t=35
Mod Nasıl Kurulur
https://www.phpbbturkey.com/viewtopic.php?t=108

Lütfen Özel Mesaj Atıp Soru Sormayınız !!!
Kullanıcı avatarı
Mirach
Destek Ekibi Lideri
Destek Ekibi Lideri
Mesajlar: 1664
Kayıt: 27.03.2006, 01:06
Konum: İstanbul

Mesaj gönderen Mirach »

bu mod ' la postlarda ( yazılarda ) kullanılan resimlerin önizlemeleri vs.. ölçüleri yönetmeniz mümkün ..Yönetim Panelinde kullanımını göreceksiniz..
Profilinde phpBB forumunun adresini girmemiş üyelere ve kurallara aykırı şekilde açılmış başlıklara destek verilmez.
Resim Resim Resim
Kullanıcı avatarı
CaN_BaKıR
Kayıtlı Kullanıcı
Mesajlar: 459
Kayıt: 17.03.2006, 01:16

Mesaj gönderen CaN_BaKıR »

Teşekküler hocam... Eline sağlık...
[ resmi görüntülemek için tıklayın ]
phpBB Nasıl Kurulur
https://www.phpbbturkey.com/viewtopic.php?t=35
Mod Nasıl Kurulur
https://www.phpbbturkey.com/viewtopic.php?t=108

Lütfen Özel Mesaj Atıp Soru Sormayınız !!!
Kullanıcı avatarı
asdf29
Kayıtlı Kullanıcı
Mesajlar: 66
Kayıt: 19.03.2006, 20:45
Konum: Hizmetten
İletişim:

Mesaj gönderen asdf29 »

bbcode.php deki

Kod: Tümünü seç

#-----[ IN-LINE BUL ]------------------------------------------
#

$text

#
#-----[ IN-LINE ÖNCESİNE EKLE ]------------------------------------------
#

//

#
#-----[ SONRASINA EKLE ]------------------------------------------
#

// end mod img size changes
bunu biraz daha açarmısın anlamadım yarıda kaldı şimdi :(
asdf29 Iz Birakir..
Kullanıcı avatarı
CaN_BaKıR
Kayıtlı Kullanıcı
Mesajlar: 459
Kayıt: 17.03.2006, 01:16

Mesaj gönderen CaN_BaKıR »

Yani şöyle olacak...

Kod: Tümünü seç

#-----[ İÇİNDE BUNU BUL ]------------------------------------------
#

$text 

#-----[ BUNUNLA DEĞİŞTİR ]------------------------------------------
#

//$text// end mod img size changes
[ resmi görüntülemek için tıklayın ]
phpBB Nasıl Kurulur
https://www.phpbbturkey.com/viewtopic.php?t=35
Mod Nasıl Kurulur
https://www.phpbbturkey.com/viewtopic.php?t=108

Lütfen Özel Mesaj Atıp Soru Sormayınız !!!
Kullanıcı avatarı
asdf29
Kayıtlı Kullanıcı
Mesajlar: 66
Kayıt: 19.03.2006, 20:45
Konum: Hizmetten
İletişim:

Mesaj gönderen asdf29 »

ama onun mantıklı olduğunu düşünüyormusunuz ki :roll:

o bölümde "$text" o kadar çok ki hangisine koyacaksın ki :?
asdf29 Iz Birakir..
Kullanıcı avatarı
CaN_BaKıR
Kayıtlı Kullanıcı
Mesajlar: 459
Kayıt: 17.03.2006, 01:16

Mesaj gönderen CaN_BaKıR »

asdf29 yazdı:ama onun mantıklı olduğunu düşünüyormusunuz ki :roll:

o bölümde "$text" o kadar çok ki hangisine koyacaksın ki :?
Ben sana ne demişim ama bak iyi oku..

Kod: Tümünü seç

#-----[ İÇİNDE BUNU BUL ]------------------------------------------
#

$text

#-----[ BUNUNLA DEĞİŞTİR ]------------------------------------------
#

//$text// end mod img size changes
içinde bul diyor değil mi orada.. mod kurulum makalesini iyi okursanız ne demek istediğini anlarsınız bunun...

AŞAĞIDAKİ GİBİ YAPACAKSIN...

Kod: Tümünü seç

#
#-----[ BUL ]------------------------------------------
#

$text = preg_replace("#\[img\]

#
#-----[ ÖNCESİNE BUNU EKLE ]------------------------------------------
#

   // mod max img size changed the first pass thingo
   preg_match_all( "#\[(img.*?)\]((http|ftp|https|ftps)://)([^ \?&=\#"\n\r\t<]*?(\.(jpg|jpeg|gif|png)))\[/img\]#sie", $text, $matches );
   // now we go through these matches and do what's needed
   foreach ( $matches[0] as $i => $m )
   {
      // easier use
      $tag = $matches[1][$i];
      $url1 = $matches[2][$i];
      $url2 = $matches[4][$i];
      
      // if we already tagged this one then we leave it be ;)
      preg_match( '#img.*?:(\d+):(\d+)#i', $tag, $match );
      if ( empty( $match ) )
      {
         // get the size so we can store it
         if ( !$size = @getimagesize( $url1 . $url2 ) )
         { // image will not get resized
            $width = '';
            $height = '';
         }
         else
         {
            $width = $size[0];
            $height = $size[1];
         }
      }
      else
      { // we already have the size
         $width = $match[1];
         $height = $match[2];
      }
      $tag = explode( ':', $tag ); // remove any possible left over : stuff
      $tag = $tag[0];
      // lastly we replace it within the text
      $text = str_replace( $m, '[' . $tag . ':' . $width . ':' . $height . ':' . $uid . ']' . $url1 . $url2 . '[/img:' . $uid . ']', $text );
   }

#
#-----[ BU EKLEDİĞİN KODLARIN İÇİNDEN TEKRAR BUL ]------------------------------------------
#

$text
#-----[ BULDUĞUNU BUNUNLA DEĞİŞTİR ]------------------------------------------
#

//$text// end mod img size changes
[ resmi görüntülemek için tıklayın ]
phpBB Nasıl Kurulur
https://www.phpbbturkey.com/viewtopic.php?t=35
Mod Nasıl Kurulur
https://www.phpbbturkey.com/viewtopic.php?t=108

Lütfen Özel Mesaj Atıp Soru Sormayınız !!!
Kullanıcı avatarı
asdf29
Kayıtlı Kullanıcı
Mesajlar: 66
Kayıt: 19.03.2006, 20:45
Konum: Hizmetten
İletişim:

Mesaj gönderen asdf29 »

CaN_BaKıR çok teşekkürler şimdi anladım :)
asdf29 Iz Birakir..
Kullanıcı avatarı
CaN_BaKıR
Kayıtlı Kullanıcı
Mesajlar: 459
Kayıt: 17.03.2006, 01:16

Mesaj gönderen CaN_BaKıR »

Kolay gelsin o zaman :D
[ resmi görüntülemek için tıklayın ]
phpBB Nasıl Kurulur
https://www.phpbbturkey.com/viewtopic.php?t=35
Mod Nasıl Kurulur
https://www.phpbbturkey.com/viewtopic.php?t=108

Lütfen Özel Mesaj Atıp Soru Sormayınız !!!
Kullanıcı avatarı
asdf29
Kayıtlı Kullanıcı
Mesajlar: 66
Kayıt: 19.03.2006, 20:45
Konum: Hizmetten
İletişim:

Mesaj gönderen asdf29 »

ya ben bunu yaptım ama forumda hiç bir değişiklik olmadı amin panelinde de bir şey yok sql de sorgulattım :roll:
asdf29 Iz Birakir..
Kullanıcı avatarı
CaN_BaKıR
Kayıtlı Kullanıcı
Mesajlar: 459
Kayıt: 17.03.2006, 01:16

Mesaj gönderen CaN_BaKıR »

Büyük bir resim ekleyip denedin mi?

Yada resimlerden herhangi birisine tıkla bakalım ne olacak?
[ resmi görüntülemek için tıklayın ]
phpBB Nasıl Kurulur
https://www.phpbbturkey.com/viewtopic.php?t=35
Mod Nasıl Kurulur
https://www.phpbbturkey.com/viewtopic.php?t=108

Lütfen Özel Mesaj Atıp Soru Sormayınız !!!
Kullanıcı avatarı
asdf29
Kayıtlı Kullanıcı
Mesajlar: 66
Kayıt: 19.03.2006, 20:45
Konum: Hizmetten
İletişim:

Mesaj gönderen asdf29 »

evet büyük resimler vardı zaten forumda oraya baktım ama hala değişen bir şey yoktu resmler hala sayfa düzenini bozuyor eski hallerindeydi..

admin panelinde de bir değişiklik yok neden adminde değişiklik yaptık ki o zaman :roll:
asdf29 Iz Birakir..
Kullanıcı avatarı
CaN_BaKıR
Kayıtlı Kullanıcı
Mesajlar: 459
Kayıt: 17.03.2006, 01:16

Mesaj gönderen CaN_BaKıR »

O halde kodlamada bir hata yapmışsın...
[ resmi görüntülemek için tıklayın ]
phpBB Nasıl Kurulur
https://www.phpbbturkey.com/viewtopic.php?t=35
Mod Nasıl Kurulur
https://www.phpbbturkey.com/viewtopic.php?t=108

Lütfen Özel Mesaj Atıp Soru Sormayınız !!!
Kullanıcı avatarı
AlleRGy
Kayıtlı Kullanıcı
Mesajlar: 885
Kayıt: 16.05.2006, 19:14
Konum: denizli
İletişim:

Mesaj gönderen AlleRGy »

hocam bu eklediğin kodun içinde bul demişsin ya onun içinde de bi kaç tane $text var hangisine koycaz sen sunun yapılmısını koyar mısın buraya?
Kilitli

“2.0.x MOD Duyuruları” sayfasına dön

Kimler çevrimiçi

Bu forumu görüntüleyen kullanıcılar: Bing [Bot] ve 2 misafir