Example #1
0
 def _already_resized_on_flickr(self, fn, pid, _megapixels):
     """Checks if image file (fn) with photo_id (pid) has already
     been resized on flickr. If so, returns True"""
     logger.debug("%s - resize requested" % (fn))
     # Get width/height from flickr
     width_flickr, height_flickr = self._getphoto_originalsize(pid)
     # Now compute what image will be if we resize it
     new_width,new_height=pusher_utils.resize_compute_width_height(\
             fn,_megapixels)
     if width_flickr == new_width and height_flickr == new_height:
         return True
     # Also return true if image couldn't be resized
     elif not new_width:
         return True
     return False
Example #2
0
 def _already_resized_on_flickr(self,fn,pid,_megapixels):
     """Checks if image file (fn) with photo_id (pid) has already
     been resized on flickr. If so, returns True"""
     logger.debug("%s - resize requested"%(fn))
     # Get width/height from flickr
     width_flickr,height_flickr=self._getphoto_originalsize(pid)
     # Now compute what image will be if we resize it
     new_width,new_height=pusher_utils.resize_compute_width_height(\
             fn,_megapixels)
     if width_flickr==new_width and height_flickr==new_height:
         return True
     # Also return true if image couldn't be resized
     elif not new_width:
         return True
     return False
Example #3
0
    def _already_resized_on_fb(self,fn,pid,_megapixels):
        """Checks if image file (fn) with photo_id (pid) has already
        been resized on fb. If so, returns True"""
        logger.debug("%s - resize requested"%(fn))
        # Get width/height from fb
        width_fb,height_fb=self._getphoto_originalsize(pid)
        # Now compute what image will be if we resize it
        new_width,new_height=pusher_utils.resize_compute_width_height(\
                fn,_megapixels)
        logger.debug("%s - fb %d/%d, current %d/%d"\
                %(fn,width_fb,height_fb,new_width,new_height))
        # Check both cases since FB sometimes rotates photos
        if width_fb==new_width and height_fb==new_height:
            return True
        elif width_fb==new_height and height_fb==new_width:
            return True

        return False