Exemple #1
0
    def post(self):

        if not self.get_uploads('file'):
           msg = 'please select an image to upload'
           path = '?msg=%s&msg_class=%s' % (msg, 'err') 
           self.redirect(path)
           return

        upload_files = self.get_uploads('file')      # 'file' is file upload field in the form
        blob_info = upload_files[0]
        blob_key = blob_info.key()

        #width = functions.getWidth(str(blob_key))
        #height = functions.getHeight(str(blob_key))

        #if height < MIN_IMAGE_HEIGHT or width < MIN_IMAGE_WIDTH:
            #pass
            #msg = 'please ensure your image is at least %d X %d pixels' % (MIN_IMAGE_HEIGHT, MIN_IMAGE_WIDTH)
            #path = '?msg=%s&msg_class=%s' % (msg, 'err')
            #blobstore.delete(blob_key)
            #self.redirect(path)
            #return
        
        url =  images.get_serving_url(blob_key)
        blob_key = str(blob_key)
        img = ImageURL(blob_key=blob_key, url = url)
        img.put()

        self.redirect('/?url=%s' % (url) )
 def new_image_url(self, new_image_url, search):
     new_image_url = ImageURL(url=new_image_url,
                              imageSeenOn=None,
                              imageLiked=None,
                              imageDisliked=None,
                              searchQuery=search)
     new_image_url.save()
Exemple #3
0
def appendURLtoUser(primary_url, img_url_id, user):
	url_extension = getExtension(primary_url)
	img_filename = str(img_url_id) + '.' + url_extension
	new_url = ImageURL(user_id = user.id, img_url = img_filename)
	new_url.save()