问题标签 [easy-thumbnails]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
django - Django easy-thumbnails 插件使图像更暗
我只有在使用 easy_thumbnails 时才会出现这种行为。如果图像未通过 easy_thumbnails 处理,则效果很好。裁剪(通过easy_thumbnails)图像变得更暗并且具有不同的色调(更绿色)。在整个过程中可能与色彩空间有关吗?
有没有人有类似的问题?谢谢
django - Django easy_thumbnails and post_delete
I am deleting a related model from a form (nearly the same way as django admin), I have an item which has many images, image belongs to Item (ForeignKey). I have implemented a post_delete signal to delete thumbnails and the image when deleting the image/images from the form, the problem is that in the post_delete thumbnails are deleted but the image entry in the db remains:
If I add the following in the end, the image instance is also deleted (expected behavior):
Am I missing something? Shouldn't the post_delete signal be sent after deleting the instance? Why is the instance persisted in the db? I assume that this has to do with Queryset delete behavior, but I am sceptical to it since If I remove the signal then the instance of ImageModel is deleted (though thumbnails do remain in the database). Mind that the model uses the django build in ImageField field, and not easy thumbnails provided fields:
The above solution (instance.delete()) is working with no problems, just curious about the behavior.
python - Django 简单缩略图:复制 ThumbnailerImagefield 对象
我的models.py中有这个:
我想将 imgA 复制到 imgB 所以我尝试了:
该函数运行没有错误,但未复制 ThumbnailerImageField。有什么办法可以做到这一点?
django - 如何仅为某些别名生成高分辨率缩略图?
我正在使用 Django 开发一个摄影网站。
因为该站点是“响应式”的,我们使用 set aliases预先生成每个图像的多种尺寸。特别是 7 张具有各种宽度的图像,从 960 到 3,840 像素宽,以 480 像素为增量。当照片全屏显示时(如在列表视图中,而不是在列表视图中),将使用这些图像。
该站点还为 HiDPI/Retina 显示器/设备构建。因此,我们想使用设置:THUMBNAIL_HIGH_RESOLUTION 来自动准备一些别名的@2x 版本,但最值得注意的是,不适用于用于创建上述全屏图像的 7 个图像范围的别名。
由于该项目旨在展示摄影师的作品,因此我们使用了相当高质量的设置,因此每张图像的初始尺寸大约为 3840x2160 像素,并且通过我们的预生成变成大约 50MB 的 JPG。不幸的是,其中近 50% 纯属浪费,因为当我们在页面上显示图像列表或图像集合时,我们只在图像上使用 @2x 版本。这些通常只有 300px/600px 宽,与我们的“全屏”图像集相比相对较小。
我们已经考虑禁用 THUMBNAIL_HIGH_RESOLUTION 并仅为@2x 版本创建新别名,但不清楚如何使用别名生成正确的文件名。
那么,我们如何才能为我们的一些别名预生成带有标准 @2x(或 _2x)中缀的 HiDPI/Retina 图像?
更新:这现在是 easy_thumbnails 的一个功能!在别名中,您可以使用 HIGH_RESOLUTION: False 来禁用它们的创建,或者使用 HIGH_RESOLUTION: True 来强制它们。谢谢@ChrisSmiley!
python - Django Easy Thumbnail 不起作用
我在一个项目中使用 django easy_thumbnail,我一步一步地按照说明进行操作。但我发现没有返回 url。
包含 imageField 的模型是:
在设置中,我指定:
我使用模板过滤器:
但是,过滤器似乎没有返回任何东西。是因为找不到网址吗?还是其他原因?谢谢你的时间!
django - 有没有办法从模板中的表单中获取文件对象?
视图.py
我想在表单页面上的表单字段旁边显示一个图像缩略图。为此,我使用了easy-thubmnails模块。我想在模板中写这样的东西:
但我不能,因为 {{ form.image }} 不是File
对象,thumbnail_url
过滤器将其作为参数。
我会很感激任何建议。
python - 无法获得简单的缩略图或 sorl 在 mac 上工作,没有产生错误
我正在尝试在mac(darwin 2.7.5)上使用django 1.6.2生成简单的缩略图。
我将在下面详细说明easy_thumbnails 的设置,我也尝试过使用sorl - 没有为任何一个生成调试(THUMBNAIL_DEBUG = True)。Easy-thumbnails 什么都不做(没有错误,不写入数据库,不产生 url)。Sorl 产生一个错误的请求 400 错误,并且没有其他调试可继续。
这就是我所做的。
从“点冻结”
运行:
转到模板并尝试以下操作:
结果:
编辑:我还应该补充说我做了以下事情:
并且没有错误。我认为问题出在其他地方,与枕头无关?我完全不知道是什么原因造成的。我知道,在某些时候,easy_thumbnails 正在工作,因为我在数据库中有数据。有些东西显然已经破坏了它,但没有任何调试,我有点不知所措,不知道下一步该去哪里。
有人可以帮忙吗?
python - Django - 在哪里为简单的缩略图自定义 THUMBNAIL_NAMER 编写代码?
我正在Django
使用美妙的easy-thumbnails
插件来生成图像缩略图的项目。我不喜欢缩略图的格式为:
source.jpg.100x100_q80_crop_upscale.jpg
如果我的图像名为source.jpg
,我宁愿有类似的东西:
source_thumb.jpg
.
在阅读插件的文档(http://easy-thumbnails.readthedocs.org/en/latest/ref/settings/)后,我发现有一个设置可以设置自定义THUMBNAIL_NAMER
,它本质上是一个返回的函数所需的缩略图字符串。
我的问题:
在我的项目中定义此功能的合适位置在哪里?我想保持一个合乎逻辑且干净的项目结构,并且不确定在哪里放置此功能。
非常感谢您的帮助:)
python - 使用 easy_thumbnails_ffmpeg
我想使用 easy_thumbnails_ffmpeg 库在 Python 中获取视频的缩略图,但是,我收到一个奇怪的错误,说找不到文件。我一直在寻找如何使用该库的示例,但没有运气也没有文档。任何的想法 ?谢谢你
日志:
python - 简单的缩略图在 Ubuntu 上不起作用
我一直在使用 Django Easy Thumbnails,它在 Mac OS X 上的本地开发服务器上运行得非常好。但我无法让它在我的 Ubuntu 生产环境中运行。我没有收到任何错误(DEBUG 设置为 True),它只是不生成图像,也不返回 URL。我不知道从哪里开始调试。