我有一个图像,上面的文本是通过 php 表单动态生成的。我将徽标图像的位置保存到 mysql 数据库中的变量中。有没有办法拍摄这个图像并将其应用于图像中的固定位置?如果需要,必须将其缩小以适应此图像区域。
我已经有一个看起来像这样的脚本:
$img = imagecreatefromjpeg('coupon/coupontemplate.jpg');
$textColor = imagecolorallocate($img, 0, 0, 0); // black text
//Write first the coupon title
imagefttext($img, 16, 0, 20, 34, $textColor, 'coupon/arialbd.ttf', $title);
//Then write the coupon description
imagettftextbox($img, 13, 0, 20, 45, $textColor, 'coupon/arial.ttf', $description, 440);
//If the checkbox to include logo is checked...
if ($_POST['clogo'] == 'y') {
$logo = $row['imagecompany'];
$logo_file = "../directory/memberimages/$logo";
$logo_file_type = getimagesize($logo_file);
if ($logo_file_type['mime'] == 'image/jpg') {
$logoImage = imagecreatefromjpeg($logo_file);
} else if ($logo_file_type['mime'] == …Run Code Online (Sandbox Code Playgroud) 我在我的网站上执行关键字搜索的mysql搜索结果.他们按会员等级排序(0-3).但是,我需要以不同的方式显示排名 - 比如排名3的格式比其他排名更突出.
我正在考虑将行拆分为单个数组.因此,array0将包含排名为0的所有行等.然后循环遍历这些数组以显示结果.我根本不知道如何做到这一点 - 将数组拆分成更小的数组.
(作为参考,我发现了这个问题:根据键名称将一个大数组拆分成较小的数组,但我不确定这是否是我需要的......也许对q的一些澄清会有帮助吗?)
例如,这是我的数组:
Array (
[rank] => 3
[organization] => Test Company
[imagecompany] => 1636.gif
[website] => http://www.google.com
[phone] => 344-433-3424
[fax] =>
[address_on_web] => physical
[address] => 2342 Test Ave
[city] => York
[stateprov] => WA
[postalcode] => 00000
[address_mailing] => 2342 Test Ave
[city_mailing] => Seattle
[state_mailing] => WA
[zip_mailing] => 00000
[description] => 'Test test Test test Test test Test test Test
test Test test Test test Test test Test …Run Code Online (Sandbox Code Playgroud) 我有一个简短的问题,我不太确定要设置.我在其他地方见过例子但没有特别喜欢我的情况.我想使用PHP调整图像大小,因此它们是可读的,而不仅仅是像你使用HTML一样令人兴奋.如果它们不是250像素宽,或160像素高,我怎样才能调整图片大小以使其成比例但适合该空间?
谢谢!