dimanche 12 avril 2015

How to convert files to jpg format in nginx?

I've just setup nginx uploading with nginx_upload_module with the following configuration:



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;
}


So all my uploaded files looks like the /var/uploads/00000x (x is a digit). I need to convert all incoming images to jpg format. Is it possible to make via building nginx functionality?


Aucun commentaire:

Enregistrer un commentaire