简体   繁体   English

如何在Codenameone中使用cloudinary缓存具有不同名称的图像

[英]How to cache images with different names using cloudinary in Codenameone

If I use codenameone URLImage, I can specify a filename for cached images... for example, I can have MyPic_Big.jpg and MyPic_Small.jpg as images coming from the same URL and possibly with different sizes. 如果我使用codenameone URLImage,我可以为缓存的图像指定文件名...例如,我可以将MyPic_Big.jpgMyPic_Small.jpg作为来自相同URL的图像,并且可能具有不同的大小。

Is there a way to do the same using cloudinary in codenameone or the Java API? 有没有办法在codenameone或Java API中使用cloudinary做同样的事情?

My use case is that I want to fetch 2 different sizes of the same image using transformation. 我的用例是我想使用转换来获取同一图像的2个不同大小。 What I noticed is that if the bigger version has already been fetched, the smaller version will use that because it found the filename in storage and Vice-versa. 我注意到,如果已经获取了更大的版本,较小的版本将使用它,因为它在存储中找到了文件名,反之亦然。

I see that you have answered this question yourself, by adding the functionality. 我看到你通过添加功能自己回答了这个问题。 I have merged your support for cacheName() to allow you to explicitly set the cache name. 我已经合并了对cacheName()的支持,以允许您显式设置缓存名称。 For future reference, the example usage is here: 供将来参考,示例用法如下:

https://github.com/shannah/cloudinary-codenameone/blob/3ce84fedd2f8364f64885de9390fe0da4d2c2725/src/com/codename1/cloudinary/CloudinaryDemo.java#L74-L79 https://github.com/shannah/cloudinary-codenameone/blob/3ce84fedd2f8364f64885de9390fe0da4d2c2725/src/com/codename1/cloudinary/CloudinaryDemo.java#L74-L79

Download the latest release here: https://github.com/shannah/cloudinary-codenameone/releases/latest 在这里下载最新版本: https//github.com/shannah/cloudinary-codenameone/releases/latest

Codename has only recently introduced an integration to Cloudinary :) Codename最近刚刚推出了与Cloudinary的集成:)
More information is available on their blog-post: 更多信息可在他们的博客文章中找到:
https://www.codenameone.com/blog/sizing-images-just-right-with-cloudinary.html https://www.codenameone.com/blog/sizing-images-just-right-with-cloudinary.html
Here's a link to their git repo: 这是他们的git repo的链接:
https://github.com/shannah/cloudinary-codenameone https://github.com/shannah/cloudinary-codenameone

Furthermore, Cloudinary also provides an official and comprehensive JAVA integration. 此外,Cloudinary还提供官方和全面的JAVA集成。
For more information, including setup instruction and code examples, see: http://cloudinary.com/documentation/java_integration 有关更多信息,包括设置说明和代码示例,请参阅: http//cloudinary.com/documentation/java_integration

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM