从视图中使用 django-easy_thumbnails

发布于 2024-09-27 20:36:34 字数 422 浏览 0 评论 0原文

easy_thumbnails 在制作缩略图模型或视图时有很大帮助。

我正在使用 templatetag(通过模板,而不是通过模型),并且 easy_thumbnails 成功创建了缩略图文件。

当我想通过视图而不是模型 o templatetag 使用 easy_thumbnails 时会发生什么(图像的渲染是通过 ajax 进行的,django 不会解析 templatetag...) 例如想象一下为这个插件显示无限的图像缩略图 http://sorgalla.com/projects/jcarousel/examples/dynamic_ajax_php.html 。有灯吗?谢谢!。

easy_thumbnails is a big help when making models or views for thumbnails.

I am using the templatetag (via template, not via model) and easy_thumbnails creates sucessfully the thumbnail files.

what happen when I want to use easy_thumbnails via view, not model o templatetag (the rendering of the images is via ajax, and django will not parse the templatetag...) for example imagine displaying infinite image thumbnails for this plugin http://sorgalla.com/projects/jcarousel/examples/dynamic_ajax_php.html . any lights? thanks!.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

夜灵血窟げ 2024-10-04 20:36:34

我不确定您在问什么,但来自 easy_thumbnails 的自述文件应该涵盖您的用例。
如果由于某种原因没有,并且您想直接在视图中使用 {%thumbnail%} 标记,那么您始终可以 render_to_string 一个仅包含 {%thumbnail%} 标记的模板,虽然这在我看来像是一个黑客。

I'm not sure what you're asking about, but README file from easy_thumbnails should cover your use case.
And if for some reason it doesn't and you want to use {% thumbnail %} tag directly in a view, then you can always render_to_string a template that contains just: {% thumbnail %} tag, although this looks to me like a hack.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文