I want to download all the images and thumbnails attached to the categories present with the help of a groovy or export script whichever is possible in Hybris.
How to download Images/thumbnails of categories in Hybris through groovy/export script?
You can do this using the Backoffice export tool like so:
You should now have a zip of all the media files you want.
Example export script, just replace the placeholder with your catalog name and adjust the flexible search statement to suit your needs:
"#% impex.setTargetFile( ""Media.csv"" );"
$catalogName=YOUR_CATALOG_ID
$version=ONLINE
$mimeType=image/jpeg
INSERT_UPDATE Media;code[unique=true];catalogVersion(catalog(id),version)[unique=true];mime;realfilename;@media[translator=de.hybris.platform.impex.jalo.media.MediaDataTranslator][forceWrite=true]
"#% impex.exportItems(""SELECT {itm.pk} FROM {Media as itm}, {CatalogVersion as cv}, {Catalog as c} WHERE {itm.catalogversion} = {cv.pk} AND {cv.catalog} = {c.PK} AND {c.id} = '$catalogName' AND {cv.version} = '$version' AND {itm.mime} = '$mimeType'"", Collections.EMPTY_MAP, Collections.singletonList( Item.class ), true, true, -1, -1 );"
Unfortunately there's one final task required since the export will only be in .bin format. You'll need to customize the data media translator. The steps are in this SAP support note: