@@ -233,7 +233,8 @@ FILE_UPLOAD_PERMISSIONS = 0o644 # TemporaryUploadedFile 文件权限设置 |
||
| 233 | 233 |
CURTAIL_UUID_LENGTH = 7 # Used in django-curtail-uuid==1.0.0 |
| 234 | 234 |
|
| 235 | 235 |
# 水印设置 |
| 236 |
-WATERMARK_LOGO = os.path.join(PROJ_DIR, 'static/pai2/img/paiai_water_mark.png').replace('\\', '/')
|
|
| 236 |
+WATERMARK_OR_NOT = False # 水印是否开启 |
|
| 237 |
+WATERMARK_LOGO_PATH = os.path.join(PROJ_DIR, 'static/pai2/img/paiai_water_mark.png').replace('\\', '/') # 水印图片路径
|
|
| 237 | 238 |
|
| 238 | 239 |
# 原图设置 |
| 239 | 240 |
LENSMAN_PHOTO_ORIGIN_EXPIRED_MSEL = 604800000 # 摄影师原图过期毫秒数,7d = 7 * 24 * 3600 * 1000msel |
@@ -5,7 +5,7 @@ Django==1.8.4 |
||
| 5 | 5 |
MySQL-python==1.2.5 |
| 6 | 6 |
Pillow==3.4.2 |
| 7 | 7 |
StatusCode==1.0.0 |
| 8 |
-TimeConvert==1.4.0 |
|
| 8 |
+TimeConvert==1.4.1 |
|
| 9 | 9 |
cryptography==1.5.2 |
| 10 | 10 |
django-curtail-uuid==1.0.0 |
| 11 | 11 |
django-detect==1.0.5 |
@@ -48,13 +48,16 @@ def file_save(file_=None, file_path=None, prefix='img', ext='.jpeg', watermark=F |
||
| 48 | 48 |
# 有水印 |
| 49 | 49 |
if watermark: |
| 50 | 50 |
if not photo.photo_watermark_path: |
| 51 |
- photo_watermark_path = 'photo/{}{}'.format(shortuuid.uuid(), ext)
|
|
| 52 |
- watermark_wrap( |
|
| 53 |
- os.path.join(settings.MEDIA_ROOT, photo_path).replace('\\', '/'),
|
|
| 54 |
- settings.WATERMARK_LOGO, |
|
| 55 |
- os.path.join(settings.MEDIA_ROOT, photo_watermark_path).replace('\\', '/')
|
|
| 56 |
- ) |
|
| 57 |
- photo.photo_watermark_path = photo_watermark_path |
|
| 51 |
+ if settings.WATERMARK_OR_NOT: |
|
| 52 |
+ photo_watermark_path = 'photo/{}{}'.format(shortuuid.uuid(), ext)
|
|
| 53 |
+ watermark_wrap( |
|
| 54 |
+ os.path.join(settings.MEDIA_ROOT, photo_path).replace('\\', '/'),
|
|
| 55 |
+ settings.WATERMARK_LOGO_PATH, |
|
| 56 |
+ os.path.join(settings.MEDIA_ROOT, photo_watermark_path).replace('\\', '/')
|
|
| 57 |
+ ) |
|
| 58 |
+ photo.photo_watermark_path = photo_watermark_path |
|
| 59 |
+ else: |
|
| 60 |
+ photo.photo_watermark_path = photo_path |
|
| 58 | 61 |
photo.save() |
| 59 | 62 |
|
| 60 | 63 |
# 缩略图 |
@@ -80,10 +83,10 @@ def file_save(file_=None, file_path=None, prefix='img', ext='.jpeg', watermark=F |
||
| 80 | 83 |
os.path.join(settings.MEDIA_ROOT, photo_thumbnail2_path).replace('\\', '/'),
|
| 81 | 84 |
settings.THUMBNAIL_MAX_WIDTH2 |
| 82 | 85 |
) |
| 83 |
- if watermark: |
|
| 86 |
+ if watermark and settings.WATERMARK_OR_NOT: |
|
| 84 | 87 |
watermark_wrap( |
| 85 | 88 |
os.path.join(settings.MEDIA_ROOT, photo_thumbnail2_path).replace('\\', '/'),
|
| 86 |
- settings.WATERMARK_LOGO, |
|
| 89 |
+ settings.WATERMARK_LOGO_PATH, |
|
| 87 | 90 |
os.path.join(settings.MEDIA_ROOT, photo_thumbnail2_path).replace('\\', '/')
|
| 88 | 91 |
) |
| 89 | 92 |
photo.photo_w = photo_w |