Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/234.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 generateThumbnail的图像质量问题_Php_Azure_Computer Vision_Microsoft Cognitive - Fatal编程技术网

Php generateThumbnail的图像质量问题

Php generateThumbnail的图像质量问题,php,azure,computer-vision,microsoft-cognitive,Php,Azure,Computer Vision,Microsoft Cognitive,测试来自PHP的Azure计算机视觉API的generateThumbnail调用。我已经能够让它运行了,但是本地保存的图像质量非常非常差。高度像素化,非常模糊,等等。它们看起来一点也不像 这是服务器端的图像处理问题,还是文件保存过程中本地发生的降级问题?我很难决定从哪里开始 这似乎与此处提出的后续问题相同: 源图像尺寸为542x1714。正在尝试创建115x115缩略图 目前的代码。已尝试将smartCropping设置为True和False $posturl = 'http

测试来自PHP的Azure计算机视觉API的
generateThumbnail
调用。我已经能够让它运行了,但是本地保存的图像质量非常非常差。高度像素化,非常模糊,等等。它们看起来一点也不像

这是服务器端的图像处理问题,还是文件保存过程中本地发生的降级问题?我很难决定从哪里开始

这似乎与此处提出的后续问题相同:

源图像尺寸为542x1714。正在尝试创建115x115缩略图

目前的代码。已尝试将smartCropping设置为True和False

        $posturl = 'https://westus.api.cognitive.microsoft.com/vision/v1.0/generateThumbnail';
        $posturl = add_query_arg( array( 'width' => $max_w, 'height' => $max_h, 'smartCropping' => true), $posturl);

        $request = wp_remote_post( $posturl, array( 'headers' => array( 'Content-Type' => 'application/octet-stream', 'Ocp-Apim-Subscription-Key' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' ), 'body' => file_get_contents( $this->file ) ) );

        if ( is_wp_error( $request ) ) {
            return null;
        } else {
            $resized = @imagecreatefromstring( $request['body'] );
        }

如果没有实际的代码(您正在使用)或者不知道图像的基本分辨率是什么,那么很难说。检查您的服务器设置。添加了代码和图像分辨率。对直接将“$request['body']”保存到文件中做了一些修补,而不是通过
imagecreatefromstring
运行它,仍然看到图像质量同样下降。老实说,我不认识Patrick,希望我能提供更多帮助。查看
phpinfo()
显示的内容是否与默认图像质量设置有关。