- def self.show cid, au
- opt = {}
- opt.merge!(PanelPicture.show_opt)
- res = PanelPicture.find(cid, opt)
- raise ActiveRecord::Forbidden unless res.visible?(au)
- res
+ def filename
+ q = self.flip.empty? ? '' : '?subdir=' + self.flip
+ self.picture.filename + q
+ end
+
+ def url
+ '/pictures/' + self.filename
+ end
+
+ def opt_div_style
+ "top:#{self.y}px; left:#{self.x}px; z-index:#{self.z}; position: absolute;"
+ end
+
+ def opt_img_tag spot = nil, opacity = 20
+ o = (spot and spot != self) ? "opacity: #{opacity.to_f/100}; filter:alpha(opacity=#{opacity});" : ''
+ self.tag_attributes(:img, {
+ :class => "panel-picture", :vPicture => self.id,
+ :src => self.url, :width => self.width.abs, :height => self.height.abs, :picture_id => self.picture_id, :ext => self.picture.ext, :alt => self.caption,
+ :style => "#{o}"
+ })
+ end
+
+ def tmb_opt_img_tag
+ tw, th = PettanImager.thumbnail_size(self.width.abs, self.height.abs)
+ {:src => self.url, :width => tw, :height => th, :alt => self.caption}
+ end
+
+ def symbol_option
+ self.picture.symbol_option
+ end
+
+ def self.public_list_where list
+ 'panels.publish > 0'