Skip to content

AssetMapper

Reads the images AssetMapper maps, by their logical path: the same path you would give to asset(). Images keep living next to your styles and scripts, in assets/ or any other AssetMapper path, and no directory is repeated in the Picasso configuration.

Terminal window
composer require symfony/asset-mapper
picasso:
loaders:
asset_mapper: ~ # the type is inferred from the name
{# assets/images/hero.jpg #}
<twig:Picasso:Image src="images/hero.jpg" loader="asset_mapper" sizes="100vw" alt="Hero" />
  • Glide reads the original file (its sourcePath), not the copy asset-map:compile writes to public/assets/, so the source files must be deployed, as they are for AssetMapper itself.
  • Only mapped assets are found: paths AssetMapper excludes (excluded_patterns) and paths with a .. segment are missing images.
  • Like the filesystem loader, it reads image dimensions by default (resolve_metadata: true): it is a local read.
  • It can be a member of a chain, e.g. to look in your uploads first, then in your assets.