如何在php中设置imagecreate形成的图像的x和y坐标(宽度、高度)


how to set the x and y cordinates of image formed by imagecreate(width, height) in php

我使用在php中创建了一个示例图像

$image = imagecreate($width , $height);

在Mozilla firefox中,它将图像显示在中间,而在chrome中,它显示在屏幕的左中间。。。

我想在屏幕上的任何地方控制这个图像的x和y坐标。此外,有人能告诉我屏幕的尺寸是多少吗;i、 e max(高度、宽度)。。。请让我知道,因为我无法解决这个问题,谢谢。

您必须使用HTML(可能还有CSS)来控制图像的显示。

试试这样的东西:

文件:image.html

<style>
    .top_corner_image img {
        border:0;
        margin:0;
        padding:0;
        position:absolute;
        top:0;
        left:0;
    }
</style>
<img class="top_corner_image" src="myimage.php">

文件:myimage.php

//put your PHP code to generate the image...
$image = imagecreate($width , $height);