Просмотр файла down/im.php

Размер файла: 1.14Kb
  1. <?php
  2. require_once('../lib/inc/fnc.php');
  3. require_once('../lib/inc/db.php');
  4. require_once('../sys/system.php');
  5. header('Content-type: image/jpg');
  6.  
  7.  
  8. if(!$_GET['w']){$W = 80;}else{$W=(int)$_GET['w'];};
  9. if(!$_GET['h']){$H = 80;}else{$H=(int)$_GET['h'];};
  10.  
  11. $id = intval($_GET['id']);
  12.  
  13.  
  14.  
  15. $file_info = mysql_fetch_array(mysql_query("SELECT `path` FROM `d_file` WHERE `id` = '$id' LIMIT 1"));
  16. $pic = 'file/'.$file_info['path'];
  17.  
  18.  
  19. if(preg_match('/\.gif$/i', $pic)){$old = imageCreateFromGif($pic);}
  20. elseif(preg_match('/\.jpg$|\.jpeg$|\.jpe$/i', $pic)){$old = imageCreateFromJpeg($pic);}
  21. elseif(preg_match('/\.png$/i', $pic)){$old = imageCreateFromPNG($pic);}
  22.  
  23. $wn = imageSX($old);
  24. $hn = imageSY($old);
  25. $prew = 1;
  26. $conf[0]['marker']=$_SERVER['HTTP_HOST'];
  27.  
  28. $new = imageCreateTrueColor($W, $H);
  29. imageCopyResampled($new, $old, 0, 0, 0, 0, $W, $H, $wn, $hn);
  30.  
  31. if($conf[0]['marker'] && $prew){
  32. // фон
  33. $bg = imagecolorallocate($new, 255, 255, 255);
  34. // цвет
  35. $color = imagecolorallocate($new, 200, 200, 200);
  36. imagestring($new, 2, ($W/2)-(strlen($conf[0]['marker'])*3), 1, $conf[0]['marker'], $color);
  37. }
  38.  
  39. imageJpeg($new,'',100);
  40.  
  41.  
  42. ?>