CuDemVN.Wap.Sh



![]() | ![]() ![]() ![]() |
<?php
echo "<img src=tubotocdo.png>"; // Gọi kết quả
$im = ImageCreateFromJpeg-68; // Link ảnh gốc
$string = " MusicSo1.Net - tubotocdo"; // Dòng chữ muốn in lên hình
$pxX = (Imagesx($im) - 20.5 * strlen($string))/2; // Tạo độ X của chữ
$pxY = Imagesy($im)-Imagesy($im) 340; // Tạo độ Y của chữ
$fontsize = "20"; // Cỡ chữ
$color = ImageColorAllocate($im, 255, 255, 255); // Màu chữ
$font = "font.ttf"; // Font chữ
ImagettfText($im, $fontsize,0, $pxX, $pxY, $color, $font, $string); // hàm viết chữ lên hình ImagettfText(Link ảnh gốc, Font size, độ nghiêng, tạo độ X , tạo độ Y, Màu, Font, Chữ muốn in)
imagePng($im,"tubotocdo.png"); // Tiến hành tạo file ảnh mới có tên tubotocdo.png và cho chữ rõ hơn hàm imagejpeg()
ImageDestroy($im);
?>
Các bạn lưu ý phần này nhé:
ImagettfText($im, $fontsize,0, $pxX, $pxY, $color, $font, $string); // hàm viết chữ lên hình
Ta thay số 0 thành số khác để chỉnh độ nghiêng. Ví dụ thành 50
Nguồn: tubotocdo

Đánh giá: 4.5/ 5, 608 bình chọn
