/var/www/protarget.com.ua/www/libs
NameSizeModeActions
class.ajax.php7940755editdlrm
class.bootstrap.php42740755editdlrm
class.controller.php9040755editdlrm
class.database.php20030755editdlrm
class.form.php30900755editdlrm
class.gd.php89820755editdlrm
class.hash.php2100755editdlrm
class.model.php17340755editdlrm
class.num_to_string.php40160755editdlrm
class.session.php11780755editdlrm
class.transfer_scales.php106260755editdlrm
class.validate.php25840755editdlrm
class.view.php9010755editdlrm
Edit: /var/www/protarget.com.ua/www/libs/class.gd.php (8982B)
$ratio) { $width = $height * $ratio; } else { $height = $width / $ratio; } $image = imagecreatetruecolor($width, $height); switch($info['extension']) { case "jpg": case "jpeg": $src = imagecreatefromjpeg ($file['file']['tmp_name']); imagecopyresampled($image, $src, 0, 0, /*left*/0, /*top*/0, $width, $height, $origWidth, $origHeight); imagejpeg($image,$path.DIRECTORY_SEPARATOR.$file['file']['name'],100); break; case "png": imagealphablending($image, false); imagesavealpha($image, true); $src = imagecreatefrompng ($file['file']['tmp_name']); imagecopyresampled($image, $src, 0, 0, /*left*/0, /*top*/0, $width, $height, $origWidth, $origHeight); imagealphablending($src, true); imagepng($image, $path.DIRECTORY_SEPARATOR.$file['file']['name'], /*compression*/0); break; case "gif": $src = imagecreatefromgif($img_src); imagecopyresampled($image, $src, 0, 0, /* left */ 0, /* top */ 0, $width, $height, $origWidth, $origHeight); header('Content-Type: image/gif'); imagegif($image,$path.DIRECTORY_SEPARATOR.$file['file']['name']); break; default: return; break; } imagedestroy($image); } public static function wrap($fontSize, $angle, $fontFace, $string, $width){ $ret = ""; $rn_count = 0; $arr = explode(' ', $string); foreach ( $arr as $word ){ $teststring = $ret.' '.$word; $testbox = imagettfbbox($fontSize, $angle, $fontFace, $teststring); if ( $testbox[2] > $width ){ if($rn_count<2){ $ret.=($ret==""?"":"\n"); if($rn_count<1)$ret.=$word; $rn_count++; } } else { if($rn_count<2){ $ret.=($ret==""?"":' ').$word; } } } return $ret; } public static function thumbImage($width, $img_src, $thumb) { if (file_exists($img_src)) { list($image_width, $image_height,$type) = getimagesize($img_src); if($type==2){ $image = imagecreatefromjpeg($img_src); }elseif($type==1){ $image= imagecreatefrompng($img_src); }elseif($type==3){ $image = imagecreatefrompng($img_src); } $height = (($width / $image_width) * $image_height); $tmp_img = imagecreatetruecolor($width, $height); imagecopyresampled($tmp_img, $image, 0, 0, 0, 0, $width, $height, $image_width, $image_height); if (is_writeable(dirname($thumb))) { imagejpeg($tmp_img, $thumb, 100); } else { echo 'Unable to save thumbnail, please check file and directory permissions.'; } // Очищаем память imagedestroy($tmp_img); imagedestroy($image); } else { echo 'File not found!'; } } public static function OutputImage ($im, $format, $quality) { switch ($format) { case "JPEG": ImageJPEG ($im, "", $quality); break; case "PNG": ImagePNG ($im); break; case "GIF": ImageGIF ($im); break; } } /** * PARAMETERS: ----------- $barcode = [required] The barcode you want to generate $type = (default=0) It's 0 for Code 3 of 9 (the only one supported) $width = (default=160) Width of image in pixels. The image MUST be wide enough to handle the length of the given value. The default value will probably be able to display about 6 digits. If you get an error message, make it wider! $height = (default=80) Height of image in pixels $format = (default=jpeg) Can be "jpeg", "png", or "gif" $quality = (default=100) For JPEG only: ranges from 0-100 $text = (default=1) 0 to disable text below barcode, >=1 to enable * * **/ public static function Barcode39 ($barcode, $width, $height, $quality, $format, $text){ switch ($format) { default: $format = "JPEG"; case "JPEG": header ("Content-type: image/jpeg"); break; case "PNG": header ("Content-type: image/png"); break; case "GIF": header ("Content-type: image/gif"); break; } $im = ImageCreate ($width, $height) or die ("Cannot Initialize new GD image stream"); $White = ImageColorAllocate ($im, 255, 255, 255); $Black = ImageColorAllocate ($im, 0, 0, 0); //ImageColorTransparent ($im, $White); ImageInterLace ($im, 1); $NarrowRatio = 20; $WideRatio = 55; $QuietRatio = 35; $nChars = (strlen($barcode)+2) * ((6 * $NarrowRatio) + (3 * $WideRatio) + ($QuietRatio)); $Pixels = $width / $nChars; $NarrowBar = (int)(20 * $Pixels); $WideBar = (int)(55 * $Pixels); $QuietBar = (int)(35 * $Pixels); $ActualWidth = (($NarrowBar * 6) + ($WideBar*3) + $QuietBar) * (strlen ($barcode)+2); if (($NarrowBar == 0) || ($NarrowBar == $WideBar) || ($NarrowBar == $QuietBar) || ($WideBar == 0) || ($WideBar == $QuietBar) || ($QuietBar == 0)) { ImageString ($im, 1, 0, 0, "Image is too small!", $Black); OutputImage ($im, $format, $quality); exit; } $CurrentBarX = (int)(($width - $ActualWidth) / 2); $Color = $White; $BarcodeFull = "*".strtoupper ($barcode)."*"; settype ($BarcodeFull, "string"); $FontNum = 3; $FontHeight = ImageFontHeight ($FontNum); $FontWidth = ImageFontWidth ($FontNum); if ($text != 0) { $CenterLoc = (int)(($width-1) / 2) - (int)(($FontWidth * strlen($BarcodeFull)) / 2); ImageString ($im, $FontNum, $CenterLoc, $height-$FontHeight, "$BarcodeFull", $Black); } else { $FontHeight=-2; } for ($i=0; $i