cms icon indicating copy to clipboard operation
cms copied to clipboard

Replace Asset in Asset Editor

Open mikemartin opened this issue 4 years ago • 8 comments

Has there ever been talk of adding a replace asset feature (similar to wp)? I ran into an issue today where I replaced assets in the filesystem but the old width/height and size of those files was stored in the meta. This caused new images to crop at the wrong aspect ratio. If the meta is generated on CP upload, maybe there could be a refresh:asset-meta command or replace asset feature in the Asset editor?

mikemartin avatar Jul 20 '21 19:07 mikemartin

I'm almost certain this has been requested, but I can't find an issue. If anyone runs into, please mention it here. 🙂

jasonvarga avatar Jul 20 '21 20:07 jasonvarga

Another idea to help with this would be a warning in the asset editor that the asset has been replaced, and ask if you want to refresh the image data (size and dimensions).

mikemartin avatar Jul 20 '21 20:07 mikemartin

If it knew it was replaced it may as well just update it automatically.

jasonvarga avatar Jul 24 '21 19:07 jasonvarga

https://github.com/statamic/ideas/issues/401

wm-simon avatar Sep 25 '21 20:09 wm-simon

If anyone needs a workaround for this you can add it with a custom Action. Here's my current implementation, it has a couple of issues but it works:

https://gist.github.com/jacksleight/ee9506d6f16af7346f0848741de317cb

jacksleight avatar Nov 19 '21 15:11 jacksleight

If anyone needs a workaround for this you can add it with a custom Action. Here's my current implementation, it has a couple of issues but it works:

gist.github.com/jacksleight/ee9506d6f16af7346f0848741de317cb

@jacksleight this should an addon!

edalzell avatar Nov 23 '21 20:11 edalzell

I have a branch in progress where I was messing with this. It may become a thing in core, we'll see!

jesseleite avatar Nov 23 '21 21:11 jesseleite

@edalzell

I considered that, but thought there were probably too many issues with it (even though it does mostly work). I imagine an implementation in core could work a lot better.

Still, if there’s demand I guess I could put an addon together, even if only as a temporary solution.

jacksleight avatar Nov 23 '21 21:11 jacksleight