Размер файла: 1.14Kb
- <?php
- require_once('../lib/inc/fnc.php');
- require_once('../lib/inc/db.php');
- require_once('../sys/system.php');
- header('Content-type: image/jpg');
-
-
- if(!$_GET['w']){$W = 80;}else{$W=(int)$_GET['w'];};
- if(!$_GET['h']){$H = 80;}else{$H=(int)$_GET['h'];};
-
- $id = intval($_GET['id']);
-
-
-
- $file_info = mysql_fetch_array(mysql_query("SELECT `path` FROM `d_file` WHERE `id` = '$id' LIMIT 1"));
- $pic = 'file/'.$file_info['path'];
-
-
- if(preg_match('/\.gif$/i', $pic)){$old = imageCreateFromGif($pic);}
- elseif(preg_match('/\.jpg$|\.jpeg$|\.jpe$/i', $pic)){$old = imageCreateFromJpeg($pic);}
- elseif(preg_match('/\.png$/i', $pic)){$old = imageCreateFromPNG($pic);}
-
- $wn = imageSX($old);
- $hn = imageSY($old);
- $prew = 1;
- $conf[0]['marker']=$_SERVER['HTTP_HOST'];
-
- $new = imageCreateTrueColor($W, $H);
- imageCopyResampled($new, $old, 0, 0, 0, 0, $W, $H, $wn, $hn);
-
- if($conf[0]['marker'] && $prew){
- // фон
- $bg = imagecolorallocate($new, 255, 255, 255);
- // цвет
- $color = imagecolorallocate($new, 200, 200, 200);
- imagestring($new, 2, ($W/2)-(strlen($conf[0]['marker'])*3), 1, $conf[0]['marker'], $color);
- }
-
- imageJpeg($new,'',100);
-
-
- ?>