Вход Регистрация
Файл: img.php
Строк: 70
<?php


define
('IN_PHPBB'true);
$phpbb_root_path  =  './';
include(
$phpbb_root_path 'extension.inc');
include(
$phpbb_root_path 'common.'.$phpEx);
include(
$phpbb_root_path 'includes/bbcode.'.$phpEx);


if (isset(
$HTTP_GET_VARS['img']) || isset($HTTP_POST_VARS['img']))
{
      if (isset(
$HTTP_GET_VARS['w']) and isset($HTTP_GET_VARS['h']) and intval($HTTP_GET_VARS['w'])>=10 and intval($HTTP_GET_VARS['h'])>=10 and intval($HTTP_GET_VARS['h'])<=250 and intval($HTTP_GET_VARS['w'])<=250)
      {
            
$w intval($HTTP_GET_VARS['w']);
            
$h intval($HTTP_GET_VARS['h']);
      }
      else if (isset(
$HTTP_POST_VARS['w']) and isset($HTTP_POST_VARS['h']) and intval($HTTP_POST_VARS['w'])>=10 and intval($HTTP_POST_VARS['h'])>=10 and intval($HTTP_POST_VARS['h'])<=250 and intval($HTTP_POST_VARS['w'])<=250)
      {
            
$w intval($HTTP_POST_VARS['w']);
            
$h intval($HTTP_POST_VARS['h']);
      } 
      else
      {
            
$w 50;
            
$h 50;
      }
      
$image intval($_GET['img']);
      
$sql 'SELECT physical_filename, mimetype 
              FROM ' 
ATTACHMENTS_DESC_TABLE 
              WHERE attach_id = ' 
$image;
      if (!
$result=$db->sql_query($sql))
      {
            exit;
      }
      
$row $db->sql_fetchrow($result);
      
$exists intval(file_exists('files/'.$row['physical_filename']));
      if (
mysql_num_rows($result) == 1  and $exists == and ereg("jpg|jpeg|gif|png"strtolower(pathinfo($row['physical_filename'], PATHINFO_EXTENSION))) == true)
      {            
            if (
$row['mimetype'] == 'image/png')
            {
                 
$im imageCreateFromPng('./files/' $row['physical_filename']);
            }
            elseif(
$row['mimetype'] == 'image/jpeg')
            {
                  if (!
$im imageCreateFromJpeg('./files/' $row['physical_filename']))
                  {
                     
message_die(GENERAL_ERROR"error"'');
                  }
            }
            elseif(
$row['mimetype'] == 'image/gif')
            {
                  
$im imageCreateFromGif('./files/' $row['physical_filename']);
            }
            else
            {
                  exit;
            }
            
$wn imageSX($im);
            
$hn imageSY($im);
            if (
$wn $w)
            {
                 
$w $wn;
            }
            if (
$hn $h)
            {
                 
$h $hn;
            }
            
$new imageCreateTrueColor($w$h);
            
imageCopyResampled($new$im0000$w$h$wn$hn);
            
$color imageColorAllocate($im888888);
            if (
$h 25 and $w 25)
            { 
                 
imageString($new1,($w/2)-(strlen($board_config['server_name'])*3-5), $h-10$board_config['server_name'], $color);
            } 
            
Header("Content-type: image/png");         
            
imagePng($new);
            
imageDestroy($im);
      }
      else
      {
           exit;
      }
}
else
{
      exit;
}

?>
Онлайн: 1
Реклама