Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
paperclip
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ikcrm_common
paperclip
Commits
91272d87
Commit
91272d87
authored
May 23, 2008
by
Jon Yurek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added ability for geometries to be procs
parent
5fdf9640
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
0 deletions
+23
-0
lib/paperclip/attachment.rb
+1
-0
test/test_attachment.rb
+22
-0
No files found.
lib/paperclip/attachment.rb
View file @
91272d87
...
...
@@ -202,6 +202,7 @@ module Paperclip
@styles
.
each
do
|
name
,
args
|
begin
dimensions
,
format
=
args
dimensions
=
dimensions
.
call
(
instance
)
if
dimensions
.
respond_to?
(
:call
)
@queued_for_write
[
name
]
=
Thumbnail
.
make
(
@queued_for_write
[
:original
],
dimensions
,
format
,
...
...
test/test_attachment.rb
View file @
91272d87
...
...
@@ -70,6 +70,28 @@ class AttachmentTest < Test::Unit::TestCase
end
end
context
"An attachment with a style that is a proc"
do
setup
do
rebuild_model
:styles
=>
{
:custom
=>
proc
{
|
i
|
"
#{
i
.
width
}
x
#{
i
.
height
}#{
i
.
modifier
}
"
}}
Dummy
.
class_eval
do
attr_accessor
:height
,
:width
,
:modifier
end
@dummy
=
Dummy
.
new
@file
=
File
.
new
(
File
.
join
(
File
.
dirname
(
__FILE__
),
"fixtures"
,
"5k.png"
))
end
should
"create a thumbnail with size 100x1000!"
do
@dummy
.
height
=
1000
@dummy
.
width
=
100
@dummy
.
modifier
=
"!"
@dummy
.
avatar
=
@file
assert
@dummy
.
save
assert_match
(
/100x1000/
,
`identify
#{
@dummy
.
avatar
.
path
(
:custom
)
}
`
)
end
end
context
"An attachment with similarly named interpolations"
do
setup
do
rebuild_model
:path
=>
":id.omg/:id-bbq/:idwhat/:id_partition.wtf"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment