旋转图片,同时使其更大

时间:2013-08-13 16:54:09

标签: php

<?php

//11.811024   
$image = imagecreatefromjpeg('test.jpg');
$rotate = imagerotate($image, 90, 0);
list($width, $height) = getimagesize('test.jpg');

// Content type
header('Content-Type: image/jpeg');

$image_p = imagecreatetruecolor($width * 11.811024, $height * 11.811024);

imagecopyresampled($image_p, $rotate, 0, 0, 0, 0, $width * 11.811024, $height * 11.811024, $width, $height);

imagejpeg($rotate);

它没有输出任何图像,但是当我注释掉imagecreatetruecolor时它确实...为什么?我该如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

我认为这可能是原因:

bool imagecopyresampled ( resource $dst_image , resource $src_image , int $dst_x , int $dst_y , int $src_x , int $src_y , int $dst_w , int $dst_h , int $src_w , int $src_h )

这是函数,1。参数是你的情况下的目标是emty图片$ image_p

但你做imagejpeg($rotate);

选择imagejpeg($image_p);以获得正确的输出。

重新采样后再尝试旋转它:)

相关问题