ImageSY($src_img)){ $image_w = (int)$w; $cof = $image_w/ImageSX($src_img); $image_h = ImageSY($src_img)*$cof; $image_offset_x = 0; $image_offset_y = (int)(($h - $image_h)/2); } else { $image_h = (int)$h; $cof = $image_h/ImageSY($src_img); $image_w = ImageSX($src_img)*$cof; $image_offset_y = 0; $image_offset_x = (int)(($w - $image_w)/2); } } else { $image_offset_x = 0; $image_offset_y = 0; $image_h = $new_h; $image_w = $new_w; } } else { if (empty($w)) { $new_w=144; } else { $new_w = (int)$w; } $new_h = (int)$h; if (empty($new_h)) $new_h = $new_w; } $px =20; $dst_img=ImageCreate($new_w,$new_h); //$dst_img=ImageCreateTrueColor($new_w,$new_h); if (empty($b)) { $b = imagecolorallocate($dst_img,200, 200,200); } else { $cr = hexdec(substr($b, 0, 2)); $cg = hexdec(substr($b, 2, 2)); $cb = hexdec(substr($b, 4, 2)); $b = imagecolorallocate($dst_img,$cr, $cg,$cb); } if (empty($f)) { $f =imagecolorallocate($dst_img,255, 255,255); } else { $cr = hexdec(substr($f, 0, 2)); $cg = hexdec(substr($f, 2, 2)); $cb = hexdec(substr($f, 4, 2)); $f = imagecolorallocate($dst_img,$cr, $cg,$cb); } if (!$err) { if (empty($fs)) { $fs= 1; } else { $fs = (int)$fs; } ImageCopyResized($dst_img,$src_img,$image_offset_x,$image_offset_y,0,0,$image_w,$image_h,ImageSX($src_img),ImageSY($src_img)); ImageStringAlignAndWrap($dst_img, $fs, $str, $f, $f, 0, $new_w, "center", "center","7"); if ($useFrame) ImageCopy($dst_img, $frame,0,0,0,0,ImageSX($frame), ImageSY($frame)); //ImageColorTransparent($dst_img, $b); //ImageColorTransparent($dst_img, $f); } else { $font_size = (int)($new_w/30); if ($new_w <51) { $alt = "X"; $font_size=5; } //ImageColorTransparent($dst_img, $orange); //ImageString($dst_img,2, (int)$new_w/2, (int)$new_h/2, $str, $white); ImageStringAlignAndWrap($dst_img, $font_size, $alt, $f, $b, 3, $new_w, "center", "center","7"); } // ImageCopyResampled($dst_img,$src_img,0,0,0,0,$new_w,$new_h,ImageSX($src_img),ImageSY($src_img)); imagejpeg($dst_img,'', $quality); imagedestroy($dst_img); ?>