Compare commits
No commits in common. "3b54dea891dfc694bbb804daeb6e5da2a4677b98" and "b8e35b533cc1c1549d2272d0571b97f1fb0d45c9" have entirely different histories.
3b54dea891
...
b8e35b533c
@ -10,6 +10,9 @@ class DataFile < ActiveRecord::Base
|
|||||||
belongs_to :data_file_category
|
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 :category_categoryables, :as => :categoryable
|
||||||
has_many :categories, :through => :category_categoryables
|
has_many :categories, :through => :category_categoryables
|
||||||
|
|
||||||
@ -60,6 +63,11 @@ class DataFile < ActiveRecord::Base
|
|||||||
{
|
{
|
||||||
title: title,
|
title: title,
|
||||||
description: long_desc,
|
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
|
created_at: created_at
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
@ -63,6 +63,82 @@ class ImageUploader < CarrierWave::Uploader::Base
|
|||||||
process :resize_to_fill => [250, 250]
|
process :resize_to_fill => [250, 250]
|
||||||
end
|
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,16 +89,21 @@
|
|||||||
|
|
||||||
|
|
||||||
-elsif input.style==1
|
-elsif input.style==1
|
||||||
.rea-gal
|
.portlet.input
|
||||||
|
%table.gallery_images
|
||||||
|
=raw "<tr>"
|
||||||
|
|
||||||
- i = 0
|
- i = 0
|
||||||
-input.gallery_images.each do |gallery_images|
|
-input.gallery_images.each do |gallery_images|
|
||||||
-if gallery_images.image_file
|
-if gallery_images.image_file
|
||||||
- i = i+1
|
- i = i+1
|
||||||
|
|
||||||
=link_to gallery_images.image_file.file.large.url, :style => "display:inline;" do
|
%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"
|
||||||
%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
|
-if i % 4 == 0
|
||||||
|
=raw "</tr><tr>"
|
||||||
|
|
||||||
|
|
||||||
|
=raw "</tr>"
|
||||||
|
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 3.2 KiB |
Binary file not shown.
Before Width: | Height: | Size: 3.1 KiB |
BIN
public/close.png
BIN
public/close.png
Binary file not shown.
Before Width: | Height: | Size: 4.7 KiB |
Loading…
x
Reference in New Issue
Block a user