如何在nginx中将文件转换为jpg格式?

如何在nginx中将文件转换为jpg格式?

我刚刚使用nginx_upload_module以下配置设置了 nginx 上传:

location = /upload {

    # backend upload_endpoint
    upload_pass @upload_endpoint;

    upload_store /var/uploads 1;

    # Set specified fields in request body
    upload_set_form_field           file[name]          "$upload_file_name";
    upload_set_form_field           file[content_type]  "$upload_content_type";
    upload_set_form_field           file[path]          "$upload_tmp_path";

    # Inform backend about hash and size of a file
    upload_aggregate_form_field     file[md5]           "$upload_file_md5";
    upload_aggregate_form_field     file[size]          "$upload_file_size";

    # remove the uploaded files if backend returns one of these HTTP status codes
    upload_cleanup 400-599;
}

# Backend file handling after uploading
location @upload_endpoint {
    internal;

    proxy_set_header    X-Real-IP                           $remote_addr;
    proxy_set_header    X-Forwarded-For                     $proxy_add_x_forwarded_for;
    proxy_set_header    X-Forwarded-Proto                   $scheme;
    proxy_set_header    Host                                $http_host;
    proxy_http_version  1.1;
    proxy_redirect      off;
    proxy_pass          http://upstream;
}

因此,我上传的所有文件看起来都像这样/var/uploads/00000x (x is a digit)。我需要将所有传入的图像转换为 jpg 格式。是否可以通过构建 nginx 功能来实现?

相关内容