from utils.watermark_utils import watermark_wrap
|
17
|
17
|
|
|
18
|
18
|
import os
|
|
|
19
|
+import shortuuid
|
|
19
|
20
|
|
|
20
|
21
|
|
|
21
|
22
|
def uuid_init(request):
|
|
|
|
@@ -85,13 +86,13 @@ def upload_photo(request):
|
|
85
|
86
|
photo_id = curtailUUID(PhotosInfo, 'photo_id')
|
|
86
|
87
|
|
|
87
|
88
|
_, extension = os.path.splitext(photo.name)
|
|
88
|
|
- m_photo_path = 'photo/{photo_id}_m{extension}'.format(photo_id=photo_id, extension=extension)
|
|
|
89
|
+ m_photo_path = 'photo/{uuid}{extension}'.format(uuid=shortuuid.uuid(), extension=extension)
|
|
89
|
90
|
|
|
90
|
91
|
if default_storage.exists(m_photo_path):
|
|
91
|
92
|
default_storage.delete(m_photo_path)
|
|
92
|
93
|
default_storage.save(m_photo_path, photo)
|
|
93
|
94
|
|
|
94
|
|
- p_photo_path = 'photo/{photo_id}_p{extension}'.format(photo_id=photo_id, extension=extension)
|
|
|
95
|
+ p_photo_path = 'photo/{uuid}{extension}'.format(uuid=shortuuid.uuid(), extension=extension)
|
|
95
|
96
|
watermark_wrap(
|
|
96
|
97
|
os.path.join(settings.MEDIA_ROOT, m_photo_path).replace('\\', '/'),
|
|
97
|
98
|
settings.WATERMARK_LOGO,
|