+ def supply_default
+ end
+
+ def overwrite ar
+ self.artist_id = ar.id
+ end
+
+ def own? ar
+ if ar.is_a?(Author)
+ self.artist_id == ar.artist.id
+ elsif ar.is_a?(Artist)
+ self.artist_id == ar.id
+ else
+ false
+ end
+ end
+
+ def visible? ar
+ return true if ar.is_a?(Admin)
+ self.own?(ar)
+ end
+
+ def filename
+ "#{self.id}.#{self.ext}"
+ end
+
+ def mime_type
+ "image/#{self.ext}"
+ end
+
+ def url
+ '/original_pictures/' + filename
+ end
+
+ def opt_img_tag
+ {:src => self.url, :width => self.width, :height => self.height}
+ end
+
+ def tmb_opt_img_tag
+ tw, th = PettanImager.thumbnail_size(self.width, self.height)
+ {:src => self.url, :width => tw, :height => th}
+ end
+
+ def unpublished?
+ self.pictures.empty?
+ end
+
+ def stopped?
+ self.pictures.any? and self.resource_picture == nil
+ end
+
+ def unlicensed?
+ self.pictures.any? and self.resource_picture and self.updated_at > self.pictures.first.head.updated_at
+ end
+
+ def published?
+ self.pictures.any? and self.resource_picture and self.updated_at < self.pictures.first.head.updated_at