stevenheidel / encore-backend

NO LONGER USED - Encore iPhone app API server written in Rails
https://www.crunchbase.com/organization/encore-fm#/entity
1 stars 0 forks source link

Images need to be resized to the correct dimensions on upload #6

Closed stevenheidel closed 10 years ago

stevenheidel commented 11 years ago

Using paperclip

ordinz commented 11 years ago

image dimensions

main: 612x612 iphone: 206x206

slavik112211 commented 11 years ago

I've searched through the backend's codebase to see which models are having images as attributes. The list is pretty exhaustive:

encore_backend/app/models/concerns/lastfmable.rb (Enables images collections for Artists, Events, Venues): module Concerns::Lastfmable embeds_many :images, class_name: "Lastfm::Image"

encore_backend/app/models/post.rb: Post.image_url

encore_backend/app/models/user.rb: class User has_many :user_photos, class_name: "Post::UserPhoto"

def facebook_image_url "https://graph.facebook.com/#{self.facebook_id}/picture?type=large" end

encore_backend/app/models/post/user_photo.rb: class Post::UserPhoto < Post include Mongoid::Paperclip

has_mongoid_attached_file :photo

encore_backend/app/models/post/youtube_video.rb class Post::YoutubeVideo < Post image_url: response.thumbnails[2].url, # [2] is the hq default

Please specify more precisely what property of what model has to have Paperclip-based images processing, and where and when should it return the scaled images. My understanding is that for all the properties that you name, whenever JSON is returned from the backend (supplying data for iOS app) - iphone: 206x206 image should be returned. In the case when web-pages are returned (demo web app) - main: 612x612 should be returned.