Giter Site home page Giter Site logo

django-watermark's Issues

FileNotFound using AWS S3

This is fully functional and awesome using Pillow and the default settings, but what would the process for integrating this with AWS S3?

Whenever I try to display the images onto a template or whatever, the .url renders out as '/file/path/djangoproject/media/<aws_img_url>'. In other words, it looks for it in the filesystem.

drop down menu show selected item when page refreshes in django

Hi,
Am new in django programming, I would like to know how to retain the value from dropdown menu when submitting the form, then come back with errors which shows other field are can't be empty.

Here are my codes:

< Choose {% for group in getcropgroup %} {{group.groupname}} {% endfor %}

Thanks in advance

relative size of watermark

I apply watermark to images which have different size. On middle size images watermark look nice, on small images it overlay, on big images it is hard to discer. Is there any possibility to set watermark size relatively to target image?

Position parsing error

Hi,

Your watermark work perfectly, but there a little error in position parsing :
At line 139 of watermarker/utils.py, the determine_position function check if the argument position passed to the function is a str : it is not, but a unicode string.
You could use basestring checking instead, which support both unicode and str instances.

L139:

     elif isinstance(position, basestring):

Good job and thanks !

Your connection attempt failed for user 'root' from your host to server at localhost:3306: Can't connect to MySQL server on '127.0.0.1' (61)

Hello,

Am getting the following error message when I try to open my connections in mysql workbench.Am using Mysql workbench 6.3 (64 -bits)

The error message:
Your connection attempt failed for user 'root' from your host to server at localhost:3306: Can't connect to MySQL server on '127.0.0.1' (61)
Please:
1 Check that mysql is running on server localhost
2 Check that mysql is running on port 3306 (note: 3306 is the default, but this can be changed)
3 Check the root has rights to connect to localhost from your address (mysql rights define what
clients can connect to the server and from which machines)
4 Make sure you are both providing a password if needed and using the correct password for
localhost connecting from the host address you're connecting from

Help would be much appreciated.

Thank you,

Peter

Upload failed (403): You are not allowed to edit 'django-watermark' package information

got this after running python setup.py sdist upload --sign:

Submitting dist/django-watermark-0.1.7.tar.gz to https://pypi.python.org/pypi
Upload failed (403): You are not allowed to edit 'django-watermark' package information
error: Upload failed (403): You are not allowed to edit 'django-watermark' package information

https://pypi.python.org/pypi?:action=role_form&package_name=django-watermark

PyPi username: bashu

A problem with an image filenames with spaces

I have a problem with filenames with spaces. I got error:
[Errno 2] No such file or directory: '/path/to/image%20with%20spaces.png'
I solved it by unquoting url on line 98 in file watermarker/templatetags/watermark.py
97 # make sure URL is a string
98 import urllib2
99 url = urllib2.unquote(str(url))

Image.ANTIALIAS is deprecated

correct line 72 in file site-packages/watermarker/templatetags/watermarker.py
replace this:
mark = mark.resize(scale, resample=Image.ANTIALIAS)
for this:
mark = mark.resize(scale, resample=Image.LANCZOS)

[Errno 13] Permission denied: 'C:\\Python27\\Scripts\\nate\\media'

I'm getting the below error after carrying out all the necessary settings. How can I get rid of this? I'm on Windows 7 machine.

     IOError at /ham/5/

    [Errno 13] Permission denied: 'C:\\Python27\\Scripts\\nate\\media'

    Request Method:     GET
    Request URL:    http://127.0.0.1:8000/ham/5/
   Django Version:  1.4
   Exception Type:  IOError
  Exception Value:  

   [Errno 13] Permission denied: 'C:\\Python27\\Scripts\\nate\\media'

   Exception Location:  C:\Python27\lib\site-packages\PIL\Image.py in open, line 1952
    Python Executable:  C:\Python27\python.exe
     Python Version:    2.7.3

PermissionError: [Errno 13] Permission denied: '/Users/peterngimbwa/Library/Caches/pip/wheels/80'

Hi,

I am new python programmer, currently am teaching myself on how to develop python web app using Flask.
I get the following error when i try to install bootstrap framework.

(myproject)Peters-MacBook-Pro:Flask_Application peterngimbwa$ pip install flask-bootstrap
Collecting flask-bootstrap
Using cached Flask-Bootstrap-3.3.5.6.tar.gz
Requirement already satisfied (use --upgrade to upgrade): Flask>=0.8 in ./myproject/lib/python3.4/site-packages/Flask-0.10.1-py3.4.egg (from flask-bootstrap)
Collecting dominate (from flask-bootstrap)
Using cached dominate-2.1.12.tar.gz
Requirement already satisfied (use --upgrade to upgrade): Werkzeug>=0.7 in ./myproject/lib/python3.4/site-packages/Werkzeug-0.10.4-py3.4.egg (from Flask>=0.8->flask-bootstrap)
Requirement already satisfied (use --upgrade to upgrade): Jinja2>=2.4 in ./myproject/lib/python3.4/site-packages/Jinja2-2.8-py3.4.egg (from Flask>=0.8->flask-bootstrap)
Requirement already satisfied (use --upgrade to upgrade): itsdangerous>=0.21 in ./myproject/lib/python3.4/site-packages/itsdangerous-0.24-py3.4.egg (from Flask>=0.8->flask-bootstrap)
Requirement already satisfied (use --upgrade to upgrade): MarkupSafe in ./myproject/lib/python3.4/site-packages/MarkupSafe-0.23-py3.4-macosx-10.6-intel.egg (from Jinja2>=2.4->Flask>=0.8->flask-bootstrap)
Building wheels for collected packages: flask-bootstrap, dominate
Exception:
Traceback (most recent call last):
File "/Users/peterngimbwa/Documents/workspace/Flask_Application/myproject/lib/python3.4/site-packages/pip/basecommand.py", line 223, in main
status = self.run(options, args)
File "/Users/peterngimbwa/Documents/workspace/Flask_Application/myproject/lib/python3.4/site-packages/pip/commands/install.py", line 293, in run
wb.build(autobuilding=True)
File "/Users/peterngimbwa/Documents/workspace/Flask_Application/myproject/lib/python3.4/site-packages/pip/wheel.py", line 756, in build
ensure_dir(output_dir)
File "/Users/peterngimbwa/Documents/workspace/Flask_Application/myproject/lib/python3.4/site-packages/pip/utils/init.py", line 70, in ensure_dir
os.makedirs(path)
File "/Users/peterngimbwa/Documents/workspace/Flask_Application/myproject/bin/../lib/python3.4/os.py", line 227, in makedirs
makedirs(head, mode, exist_ok)
File "/Users/peterngimbwa/Documents/workspace/Flask_Application/myproject/bin/../lib/python3.4/os.py", line 227, in makedirs
makedirs(head, mode, exist_ok)
File "/Users/peterngimbwa/Documents/workspace/Flask_Application/myproject/bin/../lib/python3.4/os.py", line 227, in makedirs
makedirs(head, mode, exist_ok)
File "/Users/peterngimbwa/Documents/workspace/Flask_Application/myproject/bin/../lib/python3.4/os.py", line 237, in makedirs
mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/Users/peterngimbwa/Library/Caches/pip/wheels/80'

The actual error is :
PermissionError: [Errno 13] Permission denied: '/Users/peterngimbwa/Library/Caches/pip/wheels/80'

Could anyone help me to solve the error.

Thank you

Peter

Actual watermark sample code in dynamically generated images list.

Hi from below, I wish to apply watermark to dynamically generated images, what will be the code? I see instruction sample code does seem to be compatible. Thanks. Cheers.

{% if object.picture %}

{% trans "Product Photos" %}

    {% for item in object.coimage_set.all %}
  • {{ item.name }}

    {{ item.name }}

    {{ item.description }}

  • {% empty %}
  • {% trans "There are no images yet" %}
  • {% endfor %}

Give back the maintainer right

Hi,

This repository seems to lack maintenance, I propose myself as a new maintainer.

Could you give me the right to push in your repository or just transfer it on my account in github?

Thank you

USE_TZ

Hi,

When I use "USE_TZ = True" in django.settings, I got the error:

can't compare offset-naive and offset-aware datetimes


watermarker/templatetags/watermark.py
# only return the old file if things appear to be the same
if modified >= watermark.date_updated:

'ImageFieldFile' object has no attribute 'split'

I would love to use this library, but am getting a 'ImageFieldFile' object has no attribute 'split' error. Migration was smooth, I have it declared in settings and and loaded it in my template. Any thoughts? Thank you. Below is my code.

{% if category.image %}
    <img src="/media/{{ category.image|watermark:"test,opacity=40,tile=1" }}"
              alt="{{ category.title }}" title="{{ category.title }}"
              class="img-responsive center-block shop-item-img-list-view"/>
{% else %}
    <img src="http://placehold.it/350" width="100%">
{% endif %}

import Image, ImageEnhance

Hello,

Why: import Image, ImageEnhance

Instead: from PIL import Image, ImageEnhance


I needed to do this for import directly Image and ImageEnhance:

import sys
from PIL import Image, ImageEnhance
sys.modules['Image'] = Image
sys.modules['ImageEnhance'] = ImageEnhance

URL NOT DIRECTING PROPERLY

Hello,

I successfully installed django-watermark. After setting it up, I load up the webpage. On Chrome browser, it's working fine and images are watermarked. On Mozilla firefox and Opera, it's not displaying any images not even the one I uploaded. After checking the source code, I found out that '' after "watermarked" is the one causing the problem.

   <li><img src=/media//photos/watermarked\3bbb94f57f32d2796ea59adc86310a12752f0088.jpg> </li>

Template

  <li><img src={{ MEDIA_URL }}/{{post.main_view|watermark:"hall,position=tl,opacity=90"}}> </li>

I've been looking for a way to fix this, yet no success. Please any idea on how I can fix this?

Django 4 ready?

I am sorry but i cant seem to find any reason why this app isn't working for me.
ANY assistance will be greatly appreciated

ERROR 2003 (HY000): Can't connect to MySQL server on '127.0.0.1' (61)

Hi,

Am getting this error when i try to open/create new connection on mysql workbench

Can't connect to MySQL server on '127.0.0.1' (61) .

I get the same error when I try to open my mysql using this command on my terminal:
$mysql -u root -p -h 127.0.0.1 -P 3306

the error
ERROR 2003 (HY000): Can't connect to MySQL server on '127.0.0.1' (61) .

Am using Mac OS X Yosemite 10.10.5

Help would be appreciated
Thank you

Peter

get() returned more than one Watermark -- it returned 2!

Environment:


Request Method: GET
Request URL: http://localhost:8000/

Django Version: 3.2.8
Python Version: 3.8.12
Installed Applications:
['django.contrib.admin',
 'django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'watermarker']
Installed Middleware:
['django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.common.CommonMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware']


Template error:
In template /Users/bashu/Projects/django-watermark/example/templates/index.html, error at line 6
   get() returned more than one Watermark -- it returned 2!
   1 : {% load static watermark %}
   2 : <html>
   3 :   <head></head>
   4 :   <body>
   5 :     {% with "/media/scream.jpg" as url_path %}
   6 :       <img src=" {{ url_path|watermark:"sample,scale=0.5,rotation=5,tile=1,greyscale=1,position=br,opacity=85" }} " />
   7 :     {% endwith %}
   8 :   </body>
   9 : </html>
   10 : 

Traceback (most recent call last):
  File "/Users/bashu/.virtualenvs/django-watermark/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/Users/bashu/.virtualenvs/django-watermark/lib/python3.8/site-packages/django/core/handlers/base.py", line 204, in _get_response
    response = response.render()
  File "/Users/bashu/.virtualenvs/django-watermark/lib/python3.8/site-packages/django/template/response.py", line 105, in render
    self.content = self.rendered_content
  File "/Users/bashu/.virtualenvs/django-watermark/lib/python3.8/site-packages/django/template/response.py", line 83, in rendered_content
    return template.render(context, self._request)
  File "/Users/bashu/.virtualenvs/django-watermark/lib/python3.8/site-packages/django/template/backends/django.py", line 61, in render
    return self.template.render(context)
  File "/Users/bashu/.virtualenvs/django-watermark/lib/python3.8/site-packages/django/template/base.py", line 170, in render
    return self._render(context)
  File "/Users/bashu/.virtualenvs/django-watermark/lib/python3.8/site-packages/django/template/base.py", line 162, in _render
    return self.nodelist.render(context)
  File "/Users/bashu/.virtualenvs/django-watermark/lib/python3.8/site-packages/django/template/base.py", line 938, in render
    bit = node.render_annotated(context)
  File "/Users/bashu/.virtualenvs/django-watermark/lib/python3.8/site-packages/django/template/base.py", line 905, in render_annotated
    return self.render(context)
  File "/Users/bashu/.virtualenvs/django-watermark/lib/python3.8/site-packages/django/template/defaulttags.py", line 516, in render
    return self.nodelist.render(context)
  File "/Users/bashu/.virtualenvs/django-watermark/lib/python3.8/site-packages/django/template/base.py", line 938, in render
    bit = node.render_annotated(context)
  File "/Users/bashu/.virtualenvs/django-watermark/lib/python3.8/site-packages/django/template/base.py", line 905, in render_annotated
    return self.render(context)
  File "/Users/bashu/.virtualenvs/django-watermark/lib/python3.8/site-packages/django/template/base.py", line 988, in render
    output = self.filter_expression.resolve(context)
  File "/Users/bashu/.virtualenvs/django-watermark/lib/python3.8/site-packages/django/template/base.py", line 698, in resolve
    new_obj = func(obj, *arg_vals)
  File "/Users/bashu/Projects/django-watermark/watermarker/templatetags/watermark.py", line 320, in watermark
    return Watermarker()(**params)
  File "/Users/bashu/Projects/django-watermark/watermarker/templatetags/watermark.py", line 111, in __call__
    watermark = Watermark.objects.get(name=name, is_active=True)
  File "/Users/bashu/.virtualenvs/django-watermark/lib/python3.8/site-packages/django/db/models/manager.py", line 85, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/Users/bashu/.virtualenvs/django-watermark/lib/python3.8/site-packages/django/db/models/query.py", line 439, in get
    raise self.model.MultipleObjectsReturned(

Exception Type: MultipleObjectsReturned at /
Exception Value: get() returned more than one Watermark -- it returned 2!

cannot write mode RGBA as JPEG

cannot write mode RGBA as JPEG
Request Method:	GET
Request URL:	http://192.168.1.109:8000/img
Django Version:	2.0.1
Exception Type:	OSError
Exception Value:	
cannot write mode RGBA as JPEG
Exception Location:	/env/project/lib/python3.5/site-packages/PIL/JpegImagePlugin.py in _save, line 607
Python Executable:	/env/project/bin/python
Python Version:	3.5.2
Python Path:	
['/preject/project',
 '/sofrware/pycharm-2017.3/helpers/pydev',
 '/preject/project',
 '/sofrware/pycharm-2017.3/helpers/pydev',
 '/.PyCharm2017.3/system/cythonExtensions',
 '/usr/lib/python35.zip',
 '/usr/lib/python3.5',
 '/usr/lib/python3.5/plat-x86_64-linux-gnu',
 '/usr/lib/python3.5/lib-dynload',
 '/env/project/lib/python3.5/site-packages',
 '/env/project/lib/python3.5/site-packages/setuptools-28.8.0-py3.5.egg',
 '/env/project/lib/python3.5/site-packages/pip-9.0.1-py3.5.egg',
 '/sofrware/pycharm-2017.3/helpers/pycharm_matplotlib_backend']
Server time:	ζ˜ŸζœŸδΈ‰, 4 ε››ζœˆ 2018 11:10:43 +0800```

[maybe is problem](https://github.com/python-pillow/Pillow/issues/2609)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.