Compare commits
2 Commits
b8e35b533c
...
3b54dea891
Author | SHA1 | Date | |
---|---|---|---|
|
3b54dea891 | ||
|
c8bce92e3e |
@ -10,9 +10,6 @@ class DataFile < ActiveRecord::Base
|
||||
belongs_to :data_file_category
|
||||
|
||||
|
||||
has_many :animal_animalables, :as => :animalable
|
||||
has_many :animals, :through => :animal_animalables
|
||||
|
||||
has_many :category_categoryables, :as => :categoryable
|
||||
has_many :categories, :through => :category_categoryables
|
||||
|
||||
@ -63,11 +60,6 @@ class DataFile < ActiveRecord::Base
|
||||
{
|
||||
title: title,
|
||||
description: long_desc,
|
||||
category_names: categories.map(&:name),
|
||||
category_ids: categories.map(&:id),
|
||||
animals_names: animals.map(&:name),
|
||||
animals_ids: animals.map(&:id),
|
||||
document: (data_file_category ? data_file_category.name.to_slug : "document"),
|
||||
created_at: created_at
|
||||
}
|
||||
end
|
||||
|
@ -63,82 +63,6 @@ class ImageUploader < CarrierWave::Uploader::Base
|
||||
process :resize_to_fill => [250, 250]
|
||||
end
|
||||
|
||||
version :secure do
|
||||
process :resize_to_limit => [1000, 800]
|
||||
#process :convert => 'png'
|
||||
process :watermark
|
||||
|
||||
def store_dir
|
||||
"public_medias/secure/#{model.id}"
|
||||
end
|
||||
|
||||
def filename
|
||||
"#{model.token_s}.#{file.extension}"# if original_filename.present?
|
||||
end
|
||||
|
||||
def full_filename (for_file = model.file.file)
|
||||
"secure_#{model.token_s}"+File.extname(for_file).to_s
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
version :secure_thumb do
|
||||
process :resize_to_fit => [250, 300]
|
||||
|
||||
def store_dir
|
||||
"public_medias/secure/#{model.id}"
|
||||
end
|
||||
|
||||
def filename
|
||||
"#{model.token_s}.#{file.extension}" if original_filename.present?
|
||||
end
|
||||
|
||||
def full_filename (for_file = model.file.file)
|
||||
"secure_thumb_#{model.token_s}"+File.extname(for_file).to_s
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
version :square_secure_thumb do
|
||||
process :resize_to_fill => [250, 250]
|
||||
|
||||
def store_dir
|
||||
"public_medias/secure/#{model.id}"
|
||||
end
|
||||
|
||||
def filename
|
||||
"#{model.token_s}.#{file.extension}" if original_filename.present?
|
||||
end
|
||||
|
||||
def full_filename (for_file = model.file.file)
|
||||
"square_secure_thumb_#{model.token_s}"+File.extname(for_file).to_s
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def watermark
|
||||
manipulate! do |img|
|
||||
logo = Magick::Image.read("#{Rails.root}/watermark.png").first
|
||||
puts img.rows
|
||||
puts img.columns
|
||||
#watermark = logo.resize_to_fit(img.columns * 0.4, img.rows * 0.25)
|
||||
if img.columns >= 1000 or img.rows >= 800
|
||||
watermark = logo.resize_to_fit(220, 220)
|
||||
else
|
||||
watermark = logo.resize_to_fit(img.columns * 0.4, img.rows * 0.25)
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
#img = img.composite(watermark, Magick::SouthEastGravity, (watermark.columns*-0.4), 10, Magick::OverCompositeOp)
|
||||
img = img.composite(watermark, Magick::SouthWestGravity,Magick::OverCompositeOp)
|
||||
|
||||
|
||||
#img = img.dissolve(watermark, 0.4, 1, Magick::CenterGravity)
|
||||
#img = img.watermark(watermark, 0.1,0.1, Magick::CenterGravity)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
@ -89,21 +89,16 @@
|
||||
|
||||
|
||||
-elsif input.style==1
|
||||
.portlet.input
|
||||
%table.gallery_images
|
||||
=raw "<tr>"
|
||||
.rea-gal
|
||||
|
||||
- i = 0
|
||||
-input.gallery_images.each do |gallery_images|
|
||||
-if gallery_images.image_file
|
||||
- i = i+1
|
||||
|
||||
%td=link_to image_tag(gallery_images.image_file.file.large.medium.small.thumb.url, :alt => "#{gallery_images.title}"), gallery_images.image_file.file.large.url, :rel => "prettyPhoto"
|
||||
|
||||
-if i % 4 == 0
|
||||
=raw "</tr><tr>"
|
||||
=link_to gallery_images.image_file.file.large.url, :style => "display:inline;" do
|
||||
%div.with_ratio{:style => "display:inline-block;margin:5px;width:200px;;background:center center no-repeat;background-size:cover;background-image:url('#{gallery_images.image_file.file.large.medium.small.thumb.url}');", :data => {:ratio => "0.60"}}
|
||||
.clear
|
||||
|
||||
|
||||
=raw "</tr>"
|
||||
|
||||
|
BIN
public/arrow-next.png
Executable file
BIN
public/arrow-next.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 3.2 KiB |
BIN
public/arrow-prev.png
Executable file
BIN
public/arrow-prev.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 3.1 KiB |
BIN
public/close.png
Normal file
BIN
public/close.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.7 KiB |
Loading…
x
Reference in New Issue
Block a user