Class: PostImageUploader
- Inherits:
-
CarrierWave::Uploader::Base
- Object
- CarrierWave::Uploader::Base
- PostImageUploader
- Includes:
- CarrierWave::MiniMagick
- Defined in:
- lib/uploaders/post_image_uploader.rb
Overview
The file uploader class for uploading images to a Jekyll website post
Constant Summary collapse
- PREVIEW_LIMIT =
These constants represent the maximum width and height an uploaded can be for the post preview and for actually appearing on a Jekyll website. These numbers were initially determined by testing with a 1920x1080 image. If you find a reason to change these numbers please document the reason below
[800, 800].freeze
- POST_LIMIT =
[800, 700].freeze
Instance Method Summary collapse
-
#extension_whitelist ⇒ Object
Limits only images to be uploaded to an SSE website post.
- #size_range ⇒ Object
Instance Method Details
#extension_whitelist ⇒ Object
Limits only images to be uploaded to an SSE website post
20 21 22 |
# File 'lib/uploaders/post_image_uploader.rb', line 20 def extension_whitelist %w[jpg jpeg gif png] end |
#size_range ⇒ Object
24 25 26 27 28 29 |
# File 'lib/uploaders/post_image_uploader.rb', line 24 def size_range # 5 mb is a very large photo it will probably never be reached. But # this will prevent people from passing off very large files as an image. # If you change this limit please document the reason for changing it below (1..5).step { |x| bytes_to_megabytes x } end |