您好只是想向您展示我的问题的正确代码,最后我做到了:-
<?php
$name='lubna';
$name=strtoupper($name);
$length= strlen($name);
$name_array=array();
$image_path='/var/www/letters/';
$image_array=array();
$image_hight=array();
for($i=0; $i<$length; $i++) {
$name_array[$i]=$name[$i];
$image_array[$i]=$image_path.$name[$i].'.png';
$size= getimagesize($image_array[$i]);
$hight=$size[1];
$image_hight[$i]=$hight;
}
$hight1= array_sum($image_hight);
$image = new Imagick();
$image->newImage(120, $hight1, new ImagickPixel('none'));
$image->setImageFormat('png');
$offset=0;
foreach($name_array as $id=>$value)
{
$img= new Imagick($image_path.$value.'.png');
$image->compositeimage($img, imagick::COMPOSITE_COPY,0, $offset);
$offset=$offset+$image_hight[$id];
}
//header('Content-type: image/png');
//echo $image;
$image->setImageFormat('png');
$image->writeimage('/tmp/name.png');
$cmd1="display /tmp/name.png";
$run1= exec($cmd1);
?>