Просмотр файла img.php

Размер файла: 3.33Kb
  1. <?php
  2. #----00--00----------------------------------#
  3. #----00---000----000000-----000000-#
  4. #----00---0000--00----00----00---00--#
  5. #----00---0000--00-----------00---------#
  6. #----00---0000--000000----00000--#
  7. #----00---000---00-----------00---------#
  8. #----00--00-----00---00-----00---------#
  9. #----0000-------000000----00--------#
  10. #################################################
  11. ## W@P-MOTOR 16 - 17 DOWNLOAD CENTER MOD Def ##
  12. ## Дата выхода 5 февраля 2008 г. ##
  13. ## Авторы: XsErG, VantuZ, Def ##
  14. ## Связь: http://wapruk.ru ##
  15. #################################################
  16. include ("inc/func.inc");
  17. require ("inc/conf.inc");
  18.  
  19. extract($HTTP_GET_VARS);
  20. extract($HTTP_POST_VARS);
  21.  
  22. $image = check_fulls(@$_GET['im']);
  23. $did = check_fulls(@$_GET['did']);
  24. $types = array(1 => "gif", 2 => "jpeg", 3 => "png", 4 => "jpg");
  25. $destination = $did.'/small_'.$image;
  26. $image = $did.'/'.$image;
  27.  
  28. $neww = (@$_GET['neww']);
  29. $newh = (@$_GET['newh']);
  30.  
  31. if ($neww == '' && $newh == ''){ $neww = 60; $newh = 60;}
  32.  
  33. $new_w = isset($_GET['w']) ? (int) $_GET['w'] : $neww;
  34. $new_h = isset($_GET['h']) ? (int) $_GET['h'] : $newh;
  35. if ($image_info = getimagesize($image))
  36. {
  37. $image_create_handle = "imagecreatefrom".$types[$image_info[2]];
  38. if (!$im = @$image_create_handle($image)) exit;
  39. $neww = imagesx($im);
  40. $newh = imagesy($im);
  41. $ratio = $neww/$new_w;
  42. $w_dest = round($neww/$ratio);
  43. $h_dest = round($newh/$ratio);
  44. $dest = imagecreatetruecolor($w_dest,$h_dest);
  45. imagecopyresized($dest, $im, 0, 0, 0, 0, $w_dest, $h_dest, $neww, $newh);
  46. if ($new_w >= '60' or $new_h >= '60'){
  47. if ($im_wd == 1)
  48. {
  49. // вывод текста
  50. // определяем координаты вывода текста
  51. $size = &$im_ts; // размер шрифта
  52. $x_text = $w_dest-imagefontwidth($size)*strlen($im_title)-3;
  53. $y_text = $h_dest-imagefontheight($size)-3;
  54. // определяем каким цветом на каком фоне выводить текст
  55. $white = imagecolorallocate($dest, 255, 255, 255);
  56. $black = imagecolorallocate($dest, 0, 0, 0);
  57. $gray = imagecolorallocate($dest, 127, 127, 127);
  58. if (imagecolorat($dest,$x_text,$y_text)>$gray) $color = $black;
  59. if (imagecolorat($dest,$x_text,$y_text)<$gray) $color = $white;
  60. // выводим текст
  61. imagestring($dest, $size, $x_text-1, $y_text-1, $im_title, $white-$color);
  62. imagestring($dest, $size, $x_text+1, $y_text+1, $im_title, $white-$color);
  63. imagestring($dest, $size, $x_text+1, $y_text-1, $im_title, $white-$color);
  64. imagestring($dest, $size, $x_text-1, $y_text+1, $im_title, $white-$color);
  65. imagestring($dest, $size, $x_text-1, $y_text, $im_title, $white-$color);
  66. imagestring($dest, $size, $x_text+1, $y_text, $im_title, $white-$color);
  67. imagestring($dest, $size, $x_text, $y_text-1, $im_title, $white-$color);
  68. imagestring($dest, $size, $x_text, $y_text+1, $im_title, $white-$color);
  69. imagestring($dest, $size, $x_text, $y_text, $im_title, $color);
  70. }}
  71. header("Content-Type: image/jpeg");
  72. imagejpeg($dest);
  73. imagedestroy($dest);
  74. imagedestroy($im);
  75. //imagedestroy($wat);
  76. }
  77. else echo 'Error';
  78.  
  79. ?>