<commit_before>How to upload Images
====================

Thumbor provides a ``/image`` REST end-point to upload your images and
manage it.

This way you can send thumbor your original images by doing a simple
post to its urls.

Configuration
-------------

The table below show all configuration parameters to manage image upload
:

+-----------------------------+----------------------------------+--------------------------------------------------------+
| Configuration parameter     | Default                          | Description                                            |
+=============================+==================================+========================================================+
| UPLOAD\_ENABLED             | False                            | Indicates whether thumbor should enable File uploads   |
+-----------------------------+----------------------------------+--------------------------------------------------------+
| UPLOAD\_PUT\_ALLOWED        | False                            | Indicates whether image overwrite should be allowed    |
+-----------------------------+----------------------------------+--------------------------------------------------------+
| UPLOAD\_DELETE\_ALLOWED     | False                            | Indicates whether image deletion should be allowed     |
+-----------------------------+----------------------------------+--------------------------------------------------------+
| UPLOAD\_PHOTO\_STORAGE      | thumbor.storages.file\_storage   | The type of storage to store uploaded images with      |
+-----------------------------+----------------------------------+--------------------------------------------------------+
| UPLOAD\_DEFAULT\_FILENAME   | image                            | Default filename for image uploaded                    |
+-----------------------------+----------------------------------+--------------------------------------------------------+
| UPLOAD\_MAX\_SIZE           | 0                                | Max size in Kb for images uploaded to thumbor          |
+-----------------------------+----------------------------------+--------------------------------------------------------+
| MIN\_WIDTH                  | 1                                | Min width in pixels for images uploaded                |
+-----------------------------+----------------------------------+--------------------------------------------------------+
| MIN\_HEIGHT                 | 1                                | Min width in pixels for images uploaded                |
+-----------------------------+----------------------------------+--------------------------------------------------------+

Thumbor comes with the ``/image`` REST end-point to upload disabled by
default. In order to enable it, just set the ``UPLOAD_ENABLED``
configuration in your thumbor.conf file to ``True``.

Thumbor will then use the storage specified in the
``UPLOAD_PHOTO_STORAGE`` configuration to save your images. You can use
an existing storage (filesystem, redis, mongo, hbase...) or
:doc:`create your own storage <create_my_own_storage>` if needed .

You can manage image putting and deletions simply set the configuration
parameters ``UPLOAD_PUT_ALLOWED`` and ``UPLOAD_DELETE_ALLOWED`` to
``True``. This parameters are set to ``False`` by default for security
reasons.

Finally the upload constraints (max size, image width and height) will
be controlled by ``UPLOAD_MAX_SIZE``, ``MIN_WIDTH`` and ``MIN_HEIGHT``
parameters.

API Usage
---------

The Thumbor ``/image`` REST end-point supports the commons `HTTP
methods <http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol>`__ :
\* POST : to upload a new image \* GET : to display an image uploaded \*
PUT : to replace an image uploaded by another preserving the URI \*
DELETE : to remove an image uploaded from storage

By default, ``PUT`` and ``DELETE`` methods are disabled as explained
above. This is done to tighten thumbor's security.

Posting
~~~~~~~

--------------

Posting is the only allowed by default method when you activate the<commit_msg>fix: reword a sentence that didn't read well<commit_after>How to upload Images
====================

Thumbor provides a ``/image`` REST end-point to upload your images and
manage it.

This way you can send thumbor your original images by doing a simple
post to its urls.

Configuration
-------------

The table below show all configuration parameters to manage image upload
:

+-----------------------------+----------------------------------+--------------------------------------------------------+
| Configuration parameter     | Default                          | Description                                            |
+=============================+==================================+========================================================+
| UPLOAD\_ENABLED             | False                            | Indicates whether thumbor should enable File uploads   |
+-----------------------------+----------------------------------+--------------------------------------------------------+
| UPLOAD\_PUT\_ALLOWED        | False                            | Indicates whether image overwrite should be allowed    |
+-----------------------------+----------------------------------+--------------------------------------------------------+
| UPLOAD\_DELETE\_ALLOWED     | False                            | Indicates whether image deletion should be allowed     |
+-----------------------------+----------------------------------+--------------------------------------------------------+
| UPLOAD\_PHOTO\_STORAGE      | thumbor.storages.file\_storage   | The type of storage to store uploaded images with      |
+-----------------------------+----------------------------------+--------------------------------------------------------+
| UPLOAD\_DEFAULT\_FILENAME   | image                            | Default filename for image uploaded                    |
+-----------------------------+----------------------------------+--------------------------------------------------------+
| UPLOAD\_MAX\_SIZE           | 0                                | Max size in Kb for images uploaded to thumbor          |
+-----------------------------+----------------------------------+--------------------------------------------------------+
| MIN\_WIDTH                  | 1                                | Min width in pixels for images uploaded                |
+-----------------------------+----------------------------------+--------------------------------------------------------+
| MIN\_HEIGHT                 | 1                                | Min width in pixels for images uploaded                |
+-----------------------------+----------------------------------+--------------------------------------------------------+

Thumbor comes with the ``/image`` REST end-point to upload disabled by
default. In order to enable it, just set the ``UPLOAD_ENABLED``
configuration in your thumbor.conf file to ``True``.

Thumbor will then use the storage specified in the
``UPLOAD_PHOTO_STORAGE`` configuration to save your images. You can use
an existing storage (filesystem, redis, mongo, hbase...) or
:doc:`create your own storage <create_my_own_storage>` if needed .

You can manage image putting and deletions simply set the configuration
parameters ``UPLOAD_PUT_ALLOWED`` and ``UPLOAD_DELETE_ALLOWED`` to
``True``. This parameters are set to ``False`` by default for security
reasons.

Finally the upload constraints (max size, image width and height) will
be controlled by ``UPLOAD_MAX_SIZE``, ``MIN_WIDTH`` and ``MIN_HEIGHT``
parameters.

API Usage
---------

The Thumbor ``/image`` REST end-point supports the commons `HTTP
methods <http://en.wikipedia.org/wiki/Hypertext_Transfer_Protocol>`__ :
\* POST : to upload a new image \* GET : to display an image uploaded \*
PUT : to replace an image uploaded by another preserving the URI \*
DELETE : to remove an image uploaded from storage

By default, ``PUT`` and ``DELETE`` methods are disabled as explained
above. This is done to tighten thumbor's security.

Posting
~~~~~~~

--------------

POSTing is the only method allowed by default when you activate the
{'fraction_non_alphanumeric': 0.35887440613960286, 'fraction_numerical': 0.0007309051041539773, 'mean_word_length': 1.0933197348291688, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 16, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2241779', 'n_tokens_mistral': 1554, 'n_tokens_neox': 1502, 'n_words': 620}