Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix thumbnails not showing #34

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Fix thumbnails not showing #34

wants to merge 3 commits into from

Conversation

mikbe
Copy link

@mikbe mikbe commented Nov 10, 2014

A minor omission was made that didn't allow thumbnails to show. For completeness thumbnails really should show.

To fix this yourself just add styles and a new hash to to_jq_upload like so:

class Upload < ActiveRecord::Base
  attr_accessible :upload
  has_attached_file :upload,
    styles: { 
      original: "600x600>", 
      thumbnail: "40x40#" 
    }


  include Rails.application.routes.url_helpers

  def to_jq_upload
    {
      "name" => read_attribute(:upload_file_name),
      "size" => read_attribute(:upload_file_size),
      "url" => upload.url(:original),
      "delete_url" => upload_path(self),
      "delete_type" => "DELETE",
      "thumbnail_url" => upload.url(:thumbnail)
    }
  end

end

@mikbe mikbe changed the title Fix thumbnaisl not showing Fix thumbnails not showing Nov 10, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant