我想将图像上生成的文本与图像的中心对齐.目前,我不知道是否可以对齐它.下面是代码.
$im = @imagecreatefromjpeg('poloroid.jpg');
// Create some colors
$white = imagecolorallocate($im, 255, 255, 255);
$grey = imagecolorallocate($im, 128, 128, 128);
$black = imagecolorallocate($im, 0, 0, 0);
//imagefilledrectangle($im, 0, 0, 399, 29, $white);
// The text to draw
//$text = 'John...';
$fbid = $_POST["id"];
$text = $_POST["want"];
$fb_email =$_POST["email"];
$fb_name=$_POST["name"];
$uploads_dir = 'uploaded_files/';
// Replace path by your own font path
$font = 'verdana.ttf';
//image file name
//$name ="$fbid.png";
$name = $uploads_dir.$fbid.".png"; //this saves the image inside uploaded_files folder
// Add …Run Code Online (Sandbox Code Playgroud) 我想移动一个使用imagettftext创建并保存为png的文件.正如您所看到的,在下面的代码中,我使用了move_uploaded_file但无济于事.请帮忙.
TQ
// Set the content-type
header('Content-Type: image/png');
// Create the image from created image
//$im = imagecreatetruecolor(180, 180);
$im = @imagecreatefromjpeg('poloroid.jpg');
// Create some colors
$white = imagecolorallocate($im, 255, 255, 255);
$grey = imagecolorallocate($im, 128, 128, 128);
$black = imagecolorallocate($im, 0, 0, 0);
//imagefilledrectangle($im, 0, 0, 399, 29, $white);
// The text to draw
//$text = 'John...';
$fbid = $_POST["id"];
$text = $_POST["want"];
$fb_email =$_POST["email"];
$fb_name=$_POST["name"];
$uploads_dir = '/uploaded_files';
// Replace path by your own font path
$font = …Run Code Online (Sandbox Code Playgroud) 可能重复:
glob() - 按日期排序
我想通过使用php glob基于上传日期对文件进行排序.如何通过在列表中显示最新的"已修改"/上传的图片来对其进行排序?
<?php
$files = glob("uploaded_files/*.*");
for ($i=0; $i<count($files); $i++) {
$num = $files[$i];
asort($files);
echo '<img src="'.$num.'" style="height:180px; width:180px; border:2px solid black; margin:20px 0px 10px 10px; *margin:10px 0px 10px 20px;" />'." ";
}
?>
Run Code Online (Sandbox Code Playgroud)