lib/smile/photo.rb in smile-0.4.1 vs lib/smile/photo.rb in smile-0.4.3
- old
+ new
@@ -6,10 +6,11 @@
class Smile::Photo < Smile::Base
class << self
# Convert the given xml into photo objects to play with
def from_json( json )
+ logger.info( json )
json["images"].map do |image_upper|
image = upper_hash_to_lower_hash( image_upper )
image.merge!( :image_id => image["id"] )
image.merge!( :album_key => image["album"]["key"] )
image.merge!( :album_id => image["album"]["id"] )
@@ -196,7 +197,12 @@
end
def reload!
@attributes = Smile::Photo.find( { :ImageID => self.image_id, :ImageKey => self.key } ).attributes
self
+ end
+
+ def encode64( size = :smallurl )
+ url = @attributes.send( size )
+ [open(url){ |io| io.read }].pack('m')
end
end