res.tmimg.cz
This service is outside the API (you do not need to have API access set up), but it is useful in combination when working with the API.
By calling a specific URL you get the image in the requested size and with the requested adjustments. The image is then cached on the server (including support for HTTP headers such as Last-Modified, E-tag etc.), i.e. you can also use this URL in your application.
Resizing images to the requested size
Resizing is done by calling a URL in the form
http(s)://res.tmimg.cz/{agenda (t|d|p)}/i/{floor(ad ID/1000)}/{ad ID}_{photo ID}/{width}x{height}{mode (m|c|f|r)}{-parameters}.{format}
Options:
- Both http and https can be used
- {agenda} - refers to the agenda:
tfor motorcycles,dfor parts andpfor accessories.
It can also be copied from the standard photo URL. - {width}x{height} - width and height of the image in pixels
For some crop modes one of the parameters can be omitted -
{format}
jpgpngwebp
Basic example - if the URL is, for example:
https://d.tmimg.cz/d/i/12/12345_9.jpgThe basic URL for resizing will then be:
https://res.tmimg.cz/d/i/12/12345_9/800x600.jpg
Advanced options:
-
{mode}
m- max
Default mode (if not specified)
In this mode the image is scaled to the larger of the given dimensions - the other one is calculated so that the aspect ratio of the photo does not change.
One of the dimensions can be omitted; the image is then always scaled to the given width or height.c- crop
The photo is adjusted to fill the whole specified area and is cropped so that the aspect ratio does not changef- fill
The photo is scaled down to fit the given size exactly and the remaining space is filled using the parameterbgr- resize
The photo is resized to exactly the given size, even at the cost of not preserving the aspect ratio.
-
{-parameters}
Parameters are optional. Each parameter is written in the form-nazev_hodnotaand several of them can follow one another
List of parameters:-
e- engine
Select the engine that processes the images.im- ImageMagick (for WebP, the combination of ImageMagick + CWebP)gd- GD library
-
q- quality
Quality. Default value 75.- JPEG (0-100)
- PNG (0-100, for GD a value of 0-9)
- WebP (0-100)
-
c- compress method
Compression method- JPEG (p) - if the value is
p, a progressive JPEG is created - WebP (only for ImageMagick, 0-6, default 4) - corresponds to the
-mparameter ofcwebp
- JPEG (p) - if the value is
-
bg- background
Background for thefillcrop mode. RGB is written as values 0-255 separated by underscores - e.g.-bg_255_0_0for a red background
Default colour - white (255_255_255) -
f- filter
Only for ImageMagick - applies the selected filter. Default value:CATROM
Possible values:UNDEFINED,POINT,BOX,TRIANGLE,HERMITE,HANNING,HAMMING,BLACKMAN,GAUSSIAN,QUADRATIC,CUBIC,CATROM,MITCHELL,LANCZOS,BESSEL,SINC -
nc- no-cache
Without a value - just the parameter-nc
Ignores the image in the cache (if stored) and generates it again (and stores it in the cache again)
-
Example URL:
https://res.tmimg.cz/t/i/123/123456_7/800x600f-q_80-bg_0_0_255.jpgCreates, from photo no. 7 of the motorcycle ad ID 123456, a JPEG image with quality 80 and size 800x600 - the image will be padded on a blue background.
Information on image sizes
The system also provides information on the image size, by calling a URL in the form:
http(s)://res.tmimg.cz/{agenda (t|d|p)}/i/{floor(ad ID/1000)}/{ad ID}_{photo ID}.{format}
Options:
- Both http and https can be used
- {agenda} - refers to the agenda:
tfor motorcycles,dfor parts andpfor accessories.
It can also be copied from the standard photo URL. -
{format}
json- returns data in JSON formatxml- returns data in XML format
Basic example - if the URL is, for example:
https://d.tmimg.cz/d/i/12/12345_9.jpgThe basic URL for getting the sizes will then be:
https://res.tmimg.cz/d/i/12/12345_9.xml
Resize in the API
Based on your requests, image resizing has also been built into the API - the sub-agenda resize belonging to the agenda photo.
In practice it is implemented by sending requests to res.tmimg.cz
