Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom name for withResponsiveImages on addMediaCollection #3148

Closed
ghost opened this issue Jan 5, 2023 · 1 comment
Closed

Custom name for withResponsiveImages on addMediaCollection #3148

ghost opened this issue Jan 5, 2023 · 1 comment

Comments

@ghost
Copy link

ghost commented Jan 5, 2023

Hi,

I'm not sure if this is a bug, but whenever I try to add responsive images like

public function registerMediaCollections(Media $media = null): void
{
    $this->addMediaCollection('banner')
        ->withResponsiveImages()
        ->singleFile();
}

And upload an image it will make a bunch of images like
/storage/app/public/{id}/responsive-images/{name}___media_library_original_{width}_{height}.{extension}.

Now I would like to change ___media_library_original_ to something else. I saw that it does work with conversionName.

So when you do

public function registerMediaCollections(Media $media = null): void
{
    $this->addMediaCollection('banner')
        ->singleFile();

    $this->addMediaConversion('responsive')
        ->withResponsiveImages();
}

It will generate another conversions folder with a single conversion file.
But also in /responsive-images it will generate both the responsive and media_library_original files.
So you'll have duplicated files.

It it supposed to work like this ? Shouldn't it only generate the
/storage/app/public/{id}/responsive-images/{name}___responsive_{width}_{height}.{extension}.
and not generate the
/storage/app/public/{id}/responsive-images/{name}___media_library_original_{width}_{height}.{extension}.
anymore ?

Or what's the correct way to achieve this.

@ghost ghost changed the title Custom name for withResponsiveImages on collection Custom name for withResponsiveImages on addMediaCollection Jan 5, 2023
@freekmurze
Copy link
Member

I'd accept a PR (including tests) that fixes this.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant