Je to tuším upravený iMinimize_MOD
Asi si nevzpomenu na všechno, ale alespoň část ...
includes/bbcode.php kolem cca 240 řádku
case 4:
if ($user->optionget('viewimg'))
{
$this->bbcode_cache[$bbcode_id] = array(
'preg' => array(
'#\[img:$uid\]\[{1}([^\[]*)\]{1}(.*?)(http://)*\[/img:$uid\]#s' => $this->bbcode_tpl('img', $bbcode_id, true),
'#\[img\]\[{1}([^\[]*)\]{1}(.*?)(http://)*\[/img\]#s' => $this->bbcode_tpl('img', -1, true),
'#\[img:$uid\](.*?)(http://)*\[/img:$uid\]#s' => $this->bbcode_tpl('img1', $bbcode_id, true),
'#\[img\](.*?)(http://)*\[/img\]#s' => $this->bbcode_tpl('img1', -1, true),
)
);
}
else
{
$this->bbcode_cache[$bbcode_id] = array(
'preg' => array(
'#\[img:$uid\]\[{1}[^\[]*\]{1}(.*?)\[/img:$uid\]#s' => str_replace('$2', '[ img ]', $this->bbcode_tpl('url', $bbcode_id, true)),
)
);
}
break;
dále kolem řádku 420
'img1' => '<img src="$1" alt="' . $user->lang['IMAGE'] . '" />',
'img' => '<a href="$2"><img src="$1" alt="' . $user->lang['IMAGE'] . '" /></a>',
480
'img1' => array('{URL}' => '$1'),
'img' => array('{URL1}' => '$2', '{URL2}' => '$1'),
pak v templatu bbcode.html
<!-- BEGIN img1 --><img src="{URL}" alt="{L_IMAGE}" /><!-- END img1 -->
<!-- BEGIN img --><a href="{URL1}" target="_blank"><img src="{URL2}" alt="{L_IMAGE}" /></a><!-- END img -->
includes/message_parser.php
function log($text){
$file = dirname(__FILE__)."/debug.log";
$text = time()."\t".$text."\r\n";
file_put_contents($file, $text, FILE_APPEND);
}
function cisti($string) {
$wi_dia = array('á','ä','č','ď','é','ě','ë','í','ľ','ň','ó','ö','ř','š','ť','ú','ů','ü','ý','ž',
'Á','Ä','Č','Ď','É','Ě','Ë','Í','Ň','Ó','Ö','Ř','Š','Ť','Ú','Ů','Ü','Ý','Ž');
$wo_dia = array('a','a','c','d','e','e','e','i','l','n','o','o','r','s','t','u','u','u','y','z',
'A','A','C','D','E','E','E','I','N','O','O','R','S','T','U','U','U','Y','Z');
// výraz \\pL potřebuje PHP 5.1.0 a vyšší
$out = preg_replace('/[^\\pL0-9_]+/u', '-', $string);
$out = strtolower(str_replace($wi_dia, $wo_dia, $out));
return trim(preg_replace('/[^-a-z0-9_]+/', '', $out), '-');
}
// iMinimize_MOD - start
function getsize($url, $iWidth = 300, $iHeight = 0) {
// JPEG Quality
$this->log("getsize - start");
$quality = 90;
global $phpbb_root_path;
$base = basename($url);
$base_ext = substr($base, 0, -4);
$id = $this->cisti($base_ext."_".time());
// broken_link
$broken_link = $phpbb_root_path . "images/broken_link.gif";
if(@!$size = getimagesize($url)) {
return $broken_link;
}
$img_size = getimagesize($url);
$this->log("getimagesize: ".var_export($img_size, true));
$real_width = $img_size[0];
$real_height = $img_size[1];
if($real_width > $iWidth OR $real_height > $iHeight) {
// Find the height or width if 0 is the value.
if($iHeight == 0) {
$percent = $size[1] / $size[0] * 100;
$iHeight = round($iWidth / 100 * $percent, 0);
}
if($iWidth == 0) {
$percent = $size[0] / $size[1] * 100;
$iWidth = round($iHeight / 100 * $percent, 0);
}
// Look up the extension of the image and use the right functions.
$cut_url = strlen($url) - 3;
$ext = substr($url, $cut_url);
// .jpg
if($ext == "jpg") {
$im = imagecreatefromjpeg($url);
$this->log("imagecreatefromjpeg: ".var_export($im, true));
$ow = imagesx( $im );
$oh = imagesy( $im );
$this->log("imagesx: ".var_export($ow, true));
$this->log("imagesy: ".var_export($oh, true));
$wscale = $iWidth / $ow;
$hscale = $iHeight / $oh;
$scale = ( $hscale < $wscale ? $hscale : $wscale );
$nw = round( $ow * $scale, 0 );
$nh = round( $oh * $scale, 0 );
$dstim = imagecreatetruecolor( $nw, $nh );
imagecopyresampled( $dstim, $im, 0, 0, 0, 0, $nw ,$nh ,$ow ,$oh );
$imagejpeg = imagejpeg( $dstim, $phpbb_root_path . "images/thumbs/" . $id . ".jpg", $quality);
$this->log("imagejpeg: ".$imagejpeg);
imagedestroy( $dstim );
$thumb = $id . ".jpg";
// .gif
} elseif($ext == "gif") {
$im = imagecreatefromgif($url);
$this->log("imagecreatefromgif: ".var_export($im, true));
$ow = imagesx( $im );
$oh = imagesy( $im );
$this->log("imagesx: ".var_export($ow, true));
$this->log("imagesy: ".var_export($oh, true));
$wscale = $iWidth / $ow;
$hscale = $iHeight / $oh;
$scale = ( $hscale < $wscale ? $hscale : $wscale );
$nw = round( $ow * $scale, 0 );
$nh = round( $oh * $scale, 0 );
$dstim = imagecreatetruecolor( $nw, $nh );
imagecopyresampled( $dstim, $im, 0, 0, 0, 0, $nw ,$nh ,$ow ,$oh );
$imagegif = imagegif( $dstim, $phpbb_root_path . "images/thumbs/" . $id . ".gif");
$this->log("imagegif: ".$imagegif);
imagedestroy( $dstim );
$thumb = $id . ".gif";
// .png
} elseif($ext == "png") {
$im = imagecreatefrompng($url);
$this->log("imagecreatefrompng: ".var_export($im, true));
$ow = imagesx( $im );
$oh = imagesy( $im );
$this->log("imagesx: ".var_export($ow, true));
$this->log("imagesy: ".var_export($oh, true));
$wscale = $iWidth / $ow;
$hscale = $iHeight / $oh;
$scale = ( $hscale < $wscale ? $hscale : $wscale );
$nw = round( $ow * $scale, 0 );
$nh = round( $oh * $scale, 0 );
$dstim = imagecreatetruecolor( $nw, $nh );
imagecopyresampled( $dstim, $im, 0, 0, 0, 0, $nw ,$nh ,$ow ,$oh );
$imagepng = imagepng( $dstim, $phpbb_root_path . "images/thumbs/" . $id . ".png");
$this->log("imagepng: ".$imagepng);
imagedestroy( $dstim );
$thumb = $id . ".png";
// Hvis det skulle vćre .php endelser!
} elseif($ext == "php") {
$iUrl = "ne-php!";
return $iUrl;
// Ellers kan billedet ikke virke!
} else {
return $broken_link;
}
}
$iUrl = "[" . $phpbb_root_path . "images/thumbs/" . $thumb . "]" . $this->bbcode_specialchars($url);
// Hvis billedet nu ikke er for stort!
if($real_width <= $iWidth && $real_height <= $iHeight) {
# $iUrl = "[" . $url . "]" . $url;
$iUrl = $this->bbcode_specialchars($url);
}
$this->log("return: ".$iUrl);
$this->log("end\r\n\r\n");
return $iUrl;
}
// iMinimize_MOD - end
/**
* Parse img tag
*/
function bbcode_img($in)
{
global $user, $config;
if (!$this->check_bbcode('img', $in))
{
return $in;
}
$in = trim($in);
$error = false;
$in = str_replace(' ', '%20', $in);
// Checking urls
if (!preg_match('#^' . get_preg_expression('url') . '$#i', $in) && !preg_match('#^' . get_preg_expression('www_url') . '$#i', $in))
{
return '[img]' . $in . '[/img]';
}
// Try to cope with a common user error... not specifying a protocol but only a subdomain
if (!preg_match('#^[a-z0-9]+://#i', $in))
{
$in = 'http://' . $in;
}
if ($config['max_' . $this->mode . '_img_height'] || $config['max_' . $this->mode . '_img_width'])
{
$stats = @getimagesize($in);
if ($stats === false)
{
$error = true;
$this->warn_msg[] = $user->lang['UNABLE_GET_IMAGE_SIZE'];
}
else
{
$in = $this->getsize($in, $config['max_'.$this->mode.'_img_width'], $config['max_'.$this->mode.'_img_height']);
/*
if ($config['max_' . $this->mode . '_img_height'] && $config['max_' . $this->mode . '_img_height'] < $stats[1])
{
$error = true;
$this->warn_msg[] = sprintf($user->lang['MAX_IMG_HEIGHT_EXCEEDED'], $config['max_' . $this->mode . '_img_height']);
}
if ($config['max_' . $this->mode . '_img_width'] && $config['max_' . $this->mode . '_img_width'] < $stats[0])
{
$error = true;
$this->warn_msg[] = sprintf($user->lang['MAX_IMG_WIDTH_EXCEEDED'], $config['max_' . $this->mode . '_img_width']);
}
*/
}
}
if ($error || $this->path_in_domain($in))
{
return '[img]' . $in . '[/img]';
}
return '[img:' . $this->bbcode_uid . ']' . $in . '[/img:' . $this->bbcode_uid . ']';
}
A možná ještě někde nějaké konstanty, nebo nastavení?
Samozřejmě ty debugovací výpisy tam být nemusí, že