Class: C80AlbumGallery::GphotoUploader

Inherits:
BaseFileUploader
  • Object
show all
Defined in:
app/uploaders/c80_album_gallery/gphoto_uploader.rb

Instance Method Summary collapse

Instance Method Details

#resize_to_lgObject




30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'app/uploaders/c80_album_gallery/gphoto_uploader.rb', line 30

def resize_to_lg

  manipulate! do |img|

    w = C80AlbumGallery::Prop.first.thumb_lg_width
    h = C80AlbumGallery::Prop.first.thumb_lg_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_mdObject



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

def resize_to_md

  manipulate! do |img|

    w = C80AlbumGallery::Prop.first.thumb_md_width
    h = C80AlbumGallery::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_previewObject



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'app/uploaders/c80_album_gallery/gphoto_uploader.rb', line 81

def resize_to_preview

  manipulate! do |img|

    w = C80AlbumGallery::Prop.first.thumb_preview_width
    h = C80AlbumGallery::Prop.first.thumb_preview_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



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'app/uploaders/c80_album_gallery/gphoto_uploader.rb', line 64

def resize_to_sm

  manipulate! do |img|

    w = C80AlbumGallery::Prop.first.thumb_sm_width
    h = C80AlbumGallery::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

#store_dirObject



5
6
7
# File 'app/uploaders/c80_album_gallery/gphoto_uploader.rb', line 5

def store_dir
  "uploads/gallery/#{format("%03d",model.gallery_id)}"
end