Generar miniaturas con PIL
def testImages(request): from PIL import Image path = (‘c:/images/soluciones__1.jpg’) #content = ‘c:/images/soluciones1.jpg’ content = ‘c:/images/image.gif’ … Read More »Generar miniaturas con PIL
def testImages(request): from PIL import Image path = (‘c:/images/soluciones__1.jpg’) #content = ‘c:/images/soluciones1.jpg’ content = ‘c:/images/image.gif’ … Read More »Generar miniaturas con PIL
def downloadImage(self): img_url = ‘http://img1cdn.adoosimg.com/b195d543e38e349deac032b41be043c7-1-5.jpg’ imgName = ‘b195d543e38e349deac032b41be043c7-1-5.jpg’ imgN = “peque_%s”%imgName.replace(‘5.’,‘7.’) if imgName[-5:]==‘5.jpg’ else imgName file_path =… Read More »descargar images en disco
#agregar templatetags a APPS de settings 1.- apps/templatetags/userInfoTag.py # -*- coding: utf-8 -*- from django import template from django.shortcuts import get_object_or_404 from django.contrib.auth.models import User… Read More »incluir variables generales a la plantilla– inclusion tags
image = Image.open(imageField) if image.mode != “RGB”: image = image.convert(“RGB”) #big image.save(‘image.jpg’)
#1 from django.db import models from django.contrib.auth.models import User, UserManager class CustomUser(User): birthday = models.DateField() activation_key = models.CharField(max_length=255, blank=True, default=”) … Read More »extender auth_user django modificando campos — (aplicando herencia)
user = request.user.id
from django.db import load_backend, transaction, connection #manipular datos de una bd externa def sincronizeDB(self): myBackend = load_backend(‘mysql’) # or ‘mysql’, ‘sqlite3’,… Read More »manipular datos de una bd externa con django
#form.cleaned_data[‘videoPath’] = C:Apacheuploadsvideosvideo_test.flv path = form.cleaned_data[‘videoPath’].replace(“\”,”/“) vName = ”.join(path.split(“/“)[-1:]) #result = ‘video_test.flv’
import commands import os def execute(): cmd = ‘c:/ffmpeg/ffmpeg.exe -y -itsoffset -4 -i c:/input.mpg -vframes 1 -s 100×90 -f image2 c:/uploads/img_gen.jpg’… Read More »Sacar imagenes de un video con ffmpeg