Sha256: 0a65b287509127512789f11d5db5804fdace3ef327182c25ed99862d955c7fe5

Contents?: true

Size: 696 Bytes

Versions: 3

Compression:

Stored size: 696 Bytes

Contents

class LinkserController < ApplicationController
  def index
    if params[:url].present?
      url = params[:url]
      o = Linkser.parse url, {:max_images => 1}
      if o.is_a? Linkser::Objects::HTML
        link = Link.new
        link.title = o.title if o.title
        link.description = o.description if o.description
        link.url = o.last_url
        if o.ogp and o.ogp.image
          link.image = o.ogp.image
        elsif o.images and o.images.first
          link.image = o.images.first.url
        end
        render :partial => "links/link_preview", :locals => {:link => link}
        return
      end
    end    
        render :text => I18n.t("link.errors.only_web")
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
social_stream-0.14.1 linkser/app/controllers/linkser_controller.rb
social_stream-0.14.0 linkser/app/controllers/linkser_controller.rb
social_stream-linkser-0.0.1 app/controllers/linkser_controller.rb