thomasvantuycom / craft-cloudinary

Cloudinary integration for Craft CMS
MIT License
5 stars 2 forks source link

Moving assets between folders (dynamic folders mode) #9

Closed robinbeatty closed 4 months ago

robinbeatty commented 7 months ago

Cloudinary in dynamic folders mode (with flat dynamic folders mode flag set on Craft volume settings): When an asset is uploaded from the Craft control panel and is then moved into another folder using Craft control panel, we get a warning that the file already exists in the folder (it doesn't, though I'm imagining it's wrongly being tested against filename, cloudinary being flat in this mode, rather than the folder property also). If we choose to 'replace it', we repeatedly get the warning. If we choose to 'keep both' the asset appears to move the craft ui but disappears in the cloudinary ui – there's doesn't seem to be any way to retrieve it, which means potentially large batches of images could go missing.

Is there anything that can be done to improve this behaviour?

Thanks

thomasvantuycom commented 6 months ago

In dynamic folders mode, each filename of a certain type (image, video, or raw) must be distinct across all folders. Therefore, "image.png" in "/folder/" is equivalent to "image.png" in "/anotherfolder/". That's how Cloudinary behaves, and therefore not something I can really fix. Or is that not what you mean?

robinbeatty commented 6 months ago

Not quite what I mean. Assuming the file does have a unique filename (as enforced by Cloudinary appending a random hash to the filename on upload, e.g. original-filename_abcd.jpg), when we move the file in Craft Assets, we get a warning that it already exists.

Screenshot 2024-03-11 at 11 06 35

As described above, if we choose replace, the warning just repeats – if we choose 'keep both' the file seems to vanish from both Craft Assets volume and Cloudinary.

thomasvantuycom commented 6 months ago

Hi Robin, Today, I invested significant time in research—quite a substantial amount, actually. While I've managed to discover a solution for relocating individual assets, the functionality remains unavailable for moving entire folders at once in dynamic folder mode. This discussion has led me to the conclusion that supporting dynamic folders may not be feasible. The integration with Craft entails considerable friction and fine-tuning, making it impractical. Conversely, Cloudinary's fixed folders mode aligns well with Craft's functionality. Consequently, I believe deprecating support for dynamic folders and concentrating on enhancing the plugin within the confines of the fixed folders mode would be a more fruitful approach.