Closed valboivin closed 7 months ago
Hi Valerie,
I've added support for custom CNAMEs in version 1.4.0. I am confident that the transformation URLs should now be accurate; however, please let me know if you come across any discrepancies.
@thomasvantuycom thank you so much for this quick enhancement! 👍 😄
I still have one minor problem with the generated URL for the transformation to work.
In our Cloudinary setup, we do use the fixed folders structure. We have base folders for every environments we are using. I know there's a way for the Upload API to specify a folder
name in the upload options, but I don't see any for the transformation.
Could I suggest some more enhancements to the plugin to support base folder? I've modified the code on my side to make it work. Here's what I suggest:
Adding a field in the plugin to specifiy the base folder name and make it a property of the CloudinaryFs
class
public string $baseFolder = '';
In the getTransformUrl
function, prepend the publicId
with this base folder value
$hasBaseFolder = !(empty($fs->baseFolder));
$publicId = $asset->getUrl();
if ($isCloudinaryFs) {
$publicId = $hasDynamicFolders ? basename($asset->getPath()) : $asset->getPath();
}
if($hasBaseFolder) {
$publicId = '/'. $fs->baseFolder . '/' . $publicId;
}
Let me know what you think!
I'm suggesting a Pull Request for the support of the base folder. (#6) Feel free to review it. Thank you!
I've moved the second request to its own issue.
The asset delivery URL for my images is not the same on the deployed website versus in the CMS panel (i.e. for previews).
It seems like the URL generated for my images in the website is based on the
Base URL
I've entered in the config, which is good! Images on the live websites work just fine.However, the URL generated to preview images in the CMS or in the Assets pages of the admin is wrong. It points out to the default delivery URL for Cloudinary (https://res.cloudinary.com/...). It's not using the mentioned
base URL
from the settings in my filesystems. Since our account has its own private CDN distribution configurations, I think that the asset delivery URL should use our base url instead to work.As seen on Cloudinary documentation: