liip / liip/LiipImagineBundle

Imagine Bundle and AssetMapper

Open
#1,608 3 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Level: Bug 🐞
Dominant language
PHP
Stars
1.7k
Forks
386
Avg merge
1d 10h
Merged PRs (30d)
3

Description

### Discussed in https://github.com/liip/LiipImagineBundle/discussions/1605

Originally posted by **ebitkov** August 19, 2024
The current recommendation to handle assets is to use the AssetMapper component (https://symfony.com/doc/current/frontend/asset_mapper.html), which integrates with the Twig `asset` function and automatically adds versioning to images.

As stated in the documentation, the bundle should automatically detect the versioning and handle it: https://symfony.com/bundles/LiipImagineBundle/current/asset-versioning.html.

But for me it seems not to do it. I get a "404 - Source image for path could not be found" error.

So I'm wondering: Does this bundle support the new AssetMapper component? And if yes, am I the only one, who has problem with it?

---

As described in the discussion above, [Symfony recommends the relative new AssetMapper component as the preferred way to handle your assets](https://symfony.com/doc/current/frontend.html#assetmapper-recommended), especially for new projects. The documentation of the Imagine Bundle describes, [that it supports asset versioning](https://symfony.com/bundles/LiipImagineBundle/current/asset-versioning.html), but I noticed, that the AssetMapper component is currently not supported.

When using AssetMapper, accessing a file via the `asset` Twig function and then applying a filter on it results in a `404 - source image for path could not be found` error.

Here is a simple reproducer to test with: https://github.com/ebitkov/liip-imagine-bundle-and-asset-mapper

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the AssetMapper integration and the Twig asset function, using the linked reproducer to reproduce the 404 source-image error. Trace how versioned AssetMapper paths reach the image filter; done means applying a filter to an AssetMapper-managed image resolves successfully instead of returning the 404.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, symfony
Domain
backend, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.