FileController = require './file'

class ImageController extends FileController
	className: 'browser-image'
	img: -> $('<span class="browser-image-prew_img"></span>').css
		background:"url(#{@previewUrl()}) center center no-repeat"
		opacity: 1

	show: =>
		super
		@appendPreview()
		# @preview.attr 'data-tooltip-image', @previewUrl()

	appendPreview: =>
		(not @_previewUrl) and @preview.append @img()

	saveURL: (@_previewUrl) => @appendPreview()

	url: => @getURL? @item, @saveURL

	previewUrl: =>
		(@_previewUrl or= @getPreviewURL? @item) or @url()

module.exports = ImageController
