小编Sha*_*sir的帖子

将php生成的图像动态文本对齐在中心

我想将图像上生成的文本与图像的中心对齐.目前,我不知道是否可以对齐它.下面是代码.

$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)

php imagettftext

17
推荐指数
3
解决办法
3万
查看次数

移动上传的文件php无效

我想移动一个使用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)

php upload imagettftext

1
推荐指数
1
解决办法
872
查看次数

按最后修改的php glob排序文件

可能重复:
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;" />'."&nbsp;&nbsp;"; 
}
?>
Run Code Online (Sandbox Code Playgroud)

php glob

1
推荐指数
1
解决办法
2548
查看次数

标签 统计

php ×3

imagettftext ×2

glob ×1

upload ×1