Skip to content

Scrapy, a fast high-level web crawling & scraping framework for Python.

add docs

Mohammadtaher Abbasif39def4492f8
diff --git a/docs/topics/media-pipeline.rst b/docs/topics/media-pipeline.rst
index 7dff78390..2513faae2 100644
--- a/docs/topics/media-pipeline.rst
+++ b/docs/topics/media-pipeline.rst
@@ -656,6 +656,26 @@ See here the methods that you can override in your custom Images Pipeline:
.. versionadded:: 2.4
The *item* parameter.
+ .. method:: ImagesPipeline.thumb_path(self, request, thumb_id, response=None, info=None, *, item=None)
+
+ This method is called for every item of :setting:`IMAGES_THUMBS` per downloaded item. It returns the
+ thumbnail download path of the image originating from the specified
+ :class:`response <scrapy.http.Response>`.
+
+ In addition to ``response``, this method receives the original
+ :class:`request <scrapy.Request>`,
+ ``thumb_id``,
+ :class:`info <scrapy.pipelines.media.MediaPipeline.SpiderInfo>` and
+ :class:`item <scrapy.Item>`.
+
+ You can override this method to customize the thumbnail download path of each image.
+ You can use the ``item`` to determine the file path based on some item
+ property.
+
+ By default the :meth:`thumb_path` method returns
+ ``thumbs/<size name>/<request URL hash>.<extension>``.
+
+
.. method:: ImagesPipeline.get_media_requests(item, info)
Works the same way as :meth:`FilesPipeline.get_media_requests` method,