问题标签 [django-imagekit]

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.

0 投票
1 回答
618 浏览

django - django / ImageKit - showing absolute path to images

I'm using the ImageKit and for some reason it's displaying the absolute path to images. Any idea how to make it to display the path I have set in the MEDIA_URL ?

0 投票
2 回答
1400 浏览

django - 使用嵌套类将模型序列化为 json 不会暴露嵌套类

摘要: 问题是我无法从序列化模型中的嵌套类访问缩略图图像,并且我不知道如何在 JSON 响应中公开它。

描述:我正在尝试将我的 Thing 模型序列化为 JSON,并且它以某种方式工作。我在 JSON 响应中得到以下信息:

我刚开始使用 django-imagekit 将事物图像操作为缩略图大小,并且它在正常使用中工作,即在模板中运行“thing.thumbnail_image.url”会返回缩略图的正确 url。

我正在玩的沙箱代码:

感谢您对此的任何帮助,它已经阻止了我一天。

此致-

使用版本:
Django 1.3
PIL 1.1.7
django-imagekit 0.3.6
simplejson 2.1.3

0 投票
1 回答
1888 浏览

jquery - django - any image upload and display method using Ajax?

On my django application I'm using ImageKit to resize a image loaded to the server.

models.py

forms.py

template.html

views.py

Using some Ajax method how can I eliminate the submit button in the template.html so when the user selects the image from his/her machine, the image automatically gets uploaded to the server and then displayed back to the server?

I appreciate your help!

0 投票
1 回答
1013 浏览

django - django-imagekit 教程失败 - 不创建缩略图

我已经按照本教程进行了尝试,但失败了。我已经完全按照教程中的方式复制了所有内容。问题是 ImageKit 没有创建缩略图(显示和缩略图图像)。

这里有一些细节:

0 投票
1 回答
367 浏览

django - Imagekit 作为外键 - 在管理员中添加图像

这与在主管理屏幕的外键字段中添加信息有关。

我有一个员工模型。我需要 3 种格式的面部照片。我想django-imagekit用于处理。

我制作了一个照片模型来存储面部照片,并将其作为外键添加到Staffas 中photo = models.ForeignKey(Photo)

问题:如何直接在Staff管理屏幕中添加面部照片,即避免必须在自己的管理屏幕中单独上传面部照片然后链接到它们Staff

谢谢你的想法 ...

0 投票
1 回答
717 浏览

django - django-Imagekit 添加自定义水印

我将如何使用 imagekit .. 或其他一些包向图片添加自定义水印?在我的 django 管理员中,我需要选择几个可以应用于上传照片的水印。有人做过类似的事情吗?请帮忙!

0 投票
1 回答
1149 浏览

django - django-imagekit - 显示默认图像的更好方法?

我正在使用django-imagekit来调整我的用户头像,现在显示默认头像(如果用户没有上传他/她的头像)我这样做:

视图.py

模板.html

这很好用,但是每次用户没有上传他/她的头像时,我都会访问数据库以获取默认头像图像。

当用户没有加载头像图像时,有没有办法通过将默认图像链接归因于usr_avatar或只是在 template.html 中执行某些操作来消除对数据库的访问?谢谢!

0 投票
1 回答
811 浏览

django - django-imagekit - 为默认头像图片添加静态链接

我正在使用django-imagekit从名为 Avatar 的模型中获取图像 url,如下所示:

视图.py

模板.html

目前使用上面的代码,我可以看到为其头像加载图片的用户的图片网址。

但是有一种情况,用户没有为他们的头像加载任何图片,所以我需要将静态 url 添加到默认头像图片,但我不知道如何。

是否可以使用 template.html 中的模板标签添加静态链接以及如何添加?如果不是,我愿意接受任何解决方案。谢谢!

0 投票
1 回答
988 浏览

django - Django imagekit 和动态路径

我正在使用提供的 imagekit:imagekit

所以,我定义了两个类模型:

问题是每张照片都是在“静态/照片”路径中创建的。我的意图是根据国家名称使用动态路径保存图像和缩略图。

例如,对于国家“Argentina”,动态路径将为“static/photos/Argentina/”

我怎样才能做到这一点?

0 投票
3 回答
3332 浏览

python - Django Imagekit 处理原始图像

使用 1.1 版,我不明白如何预处理原始图像(仅使用 imagekit)

https://github.com/jdriscoll/django-imagekit/blob/develop/README.rst

有这样的模型:

例如,如何调整原始图像的大小?这在以前的 imagekits 中是可能的,但是文档暗示我需要另一个模型域?