Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/image/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 从png创建图像并调整大小_Php_Image_Gd - Fatal编程技术网

Php 从png创建图像并调整大小

Php 从png创建图像并调整大小,php,image,gd,Php,Image,Gd,我目前正在开发这个应用程序,其中一部分功能是从$\u GET数据中获取x个文件路径,然后通过它们循环创建一个新图像 这是我现在的密码 <?php $images = rtrim($_GET['images'], ","); $images = explode(",", $images); $img = imagecreatetruecolor(1060, 811); // Make alpha channels work imagealphablending($img, true

我目前正在开发这个应用程序,其中一部分功能是从$\u GET数据中获取x个文件路径,然后通过它们循环创建一个新图像

这是我现在的密码

<?php

$images = rtrim($_GET['images'], ",");

$images = explode(",", $images);

$img = imagecreatetruecolor(1060, 811);

// Make alpha channels work

imagealphablending($img, true);
imagesavealpha($img, true);

foreach($images as $fn) {

    // Load image
    $cur = imagecreatefrompng($fn);
    imagealphablending($cur, true);
    imagesavealpha($cur, true);

    // Copy over image
    imagecopyresampled($img, $cur, 0,0,0,0, 1060, 811, 1060, 811);

    // Free memory
    imagedestroy($cur);

}

header('Content-Type: image/png');
imagepng($img);

必须有数百个网页提供如何在PHP中调整图像大小的教程。这些站点中有一个无法帮助您解决的具体问题是什么?为什么不能使用imagecopyresized()@user574632它不考虑我想要的新图像大小。啊!我用错误的方法派了两个情人过来。