Class: C80News::FphotoUploader

Inherits:
BaseFileUploader
  • Object
show all
Defined in:
app/uploaders/c80_news/fphoto_uploader.rb

Instance Method Summary collapse

Instance Method Details

#resize_to_lgObject




79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'app/uploaders/c80_news/fphoto_uploader.rb', line 79

def resize_to_lg
  # byebug

  w = C80News::Prop.first.thumb_lg_width
  h = C80News::Prop.first.thumb_lg_height

  manipulate! do |img|
    img.resize "#{w}x#{h}^"
    img.gravity 'center'
    img.extent "#{w}x#{h}"
    img = yield(img) if block_given?
    img
  end

end

#resize_to_mdObject



95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'app/uploaders/c80_news/fphoto_uploader.rb', line 95

def resize_to_md

  manipulate! do |img|

    w = C80News::Prop.first.thumb_md_width
    h = C80News::Prop.first.thumb_md_height

    img.resize "#{w}x#{h}^"
    img.gravity 'center'
    img.extent "#{w}x#{h}"
    img = yield(img) if block_given?
    img

  end

end

#resize_to_smObject



112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'app/uploaders/c80_news/fphoto_uploader.rb', line 112

def resize_to_sm

  manipulate! do |img|

    w = C80News::Prop.first.thumb_sm_width
    h = C80News::Prop.first.thumb_sm_height

    img.resize "#{w}x#{h}^"
    img.gravity 'center'
    img.extent "#{w}x#{h}"
    img = yield(img) if block_given?
    img

  end

end

#resize_to_thumb_bigObject

–[ идут в контент новости ]————————————————————————————–



48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'app/uploaders/c80_news/fphoto_uploader.rb', line 48

def resize_to_thumb_big
  # byebug

  w = SiteProp.first.page_content_width
  h = calc_height_of_image(w)

  # puts "<PageArtUploader.resize_to_limit_big>"
  manipulate! do |img|
    img.resize "#{w}x#{h}>"
    img = yield(img) if block_given?
    img
  end

end

#resize_to_thumb_smallObject



63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'app/uploaders/c80_news/fphoto_uploader.rb', line 63

def resize_to_thumb_small
  # puts "<PageArtUploader.resize_to_limit_small>"
  manipulate! do |img|

    w = SiteProp.first.page_content_width/2
    h = calc_height_of_image(w)

    img.resize "#{w}x#{h}>"
    img = yield(img) if block_given?
    img

  end
end

#store_dirObject



7
8
9
# File 'app/uploaders/c80_news/fphoto_uploader.rb', line 7

def store_dir
  "uploads/news/#{format("%02d", model.fact_id)}"
end