# File app/models/logo.rb, line 45
  def self.from_blob(data, conf)
    conf = Conference.find_by_id(conf) if conf.is_a?(Fixnum)
    logo = self.find(:first, :conditions => ['conference_id = ?', conf.id]) ||
      self.new
    logo.conference_id = conf.id

    # Generate the Magick::Image object
    img = Magick::Image.from_blob(data)[0]
    logo.width = img.columns
    logo.height = img.rows

    # Re-generate the original, ensuring we have it as a PNG
    img.format = 'png'
    logo[:data] = img.to_blob

    # Generate medium-resolution and thumbnail
    med = img.thumbnail(logo.medium_width, logo.medium_height)
    logo[:medium] = med.to_blob

    thb = img.thumbnail(logo.thumb_width, logo.thumb_height)
    logo[:thumb] = thb.to_blob

    logo.save!

    logo
  end