Beispiel #1
0
def get_id_photo_back_path(instance, filename):
    ext = filename.split('.')[-1]
    filename = '%s_%s_back.%s' % (instance.customer.pk, int(time.time()), ext)
    file_path = os.path.join(settings.ID_PHOTO_FOLDER, filename)

    from apps.schedule.tasks import guetzli_compress_image
    full_path = os.path.join(settings.MEDIA_ROOT, file_path)
    guetzli_compress_image.apply_async(args=[full_path], countdown=230)
    return file_path
Beispiel #2
0
def get_product_pic_path(instance, filename):
    ext = filename.split('.')[-1]
    filename = instance.brand.name_en + '_' if instance.brand.name_en else ''
    filename = '%s%s' % (filename, instance.name_en)
    filename = filename.replace(' ', '-')
    filename = '%s.%s' % (filename, ext)
    file_path = os.path.join(PRODUCT_PHOTO_FOLDER, filename)

    from apps.schedule.tasks import guetzli_compress_image
    full_path = os.path.join(MEDIA_ROOT, file_path)
    guetzli_compress_image.apply_async(args=[full_path], countdown=20)
    return file_path