我正在用JS/PHP创建一个图像编辑器,但现在我遇到了麻烦.首先,我从数据库加载图像(使用imagecreatefromstring加载blob).然后我将一个动作列表应用于此图像.但是,如何从这个图像处理程序中获取图像大小呢?无需将其写入文件或使用流对象.怎么样??
如何实际获得旋转图像后设置的新宽度和高度?
$ps['product_angle'] = 77; //Could be any angle
$filename = 'test.png' //filename to the original product
list($source_width, $source_height) = getimagesize($filename);
$source_image = imagecreatefromjpeg($filename);
$angle = $ps['product_angle'];
if (intval($angle) <> 0) {
$source_image = imagerotate($source_image, 360-$angle, imageColorAllocateAlpha($source_image, 255, 255, 255, 127));
}
$ps['source_image'] = $source_image;
Run Code Online (Sandbox Code Playgroud)
我想要这个,因为我想根据上面创建的图像调整图像大小.($ps['source_image'])
//If I do an image
list($source_width, $source_height) = getimagesize($filename);
$dest_width = (int)$ps['product_width'];
$dest_height = (int)$ps['product_height'];
//Resize source-image to new width and height
//But this width and height are incorrect because they are
//set …Run Code Online (Sandbox Code Playgroud)