当我从数据库中检索blob(图像)时,有没有办法在没有imagerotate()的情况下在PHP中旋转此图像?
这可以在二进制级别完成吗?像切换所有像素的位置一样?
是否有比创建临时图像和调用imagerotate()更简短的方法?
考虑JPG和PNG ......它们被压缩了......也许那是不可能的?但是,它可能适用于BMP。
仅仅是为了获取信息,如果JPG目前正在进行blob图像的旋转:
$degrees = -90;
$source_image = imagecreatefromstring($blob['content']);
$rotate_image = imagerotate($source_image, $degrees, 0);
ob_start();
imagejpeg($rotate_image, null, 100);
$image_bin = ob_get_contents();
ob_end_clean();
qa_db_query_sub( 'UPDATE blobs SET content=$
WHERE blobid=#', $image_bin, $rotateBlobId );
// free the memory
imagedestroy($source_image);
imagedestroy($rotate_image);