Commit f4ec3dbba34370edd3edc200fa8228812197eb65
1 parent
63f0dc1e
Exists in
master
and in
29 other branches
ActionItem183: lot of things; ActionItem166: quase pronto
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1521 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
22 changed files
with
357 additions
and
30 deletions
Show diff stats
app/helpers/application_helper.rb
@@ -355,22 +355,24 @@ module ApplicationHelper | @@ -355,22 +355,24 @@ module ApplicationHelper | ||
355 | # generates a image tag for the profile. | 355 | # generates a image tag for the profile. |
356 | # | 356 | # |
357 | # If the profile has no image set yet, then a default image is used. | 357 | # If the profile has no image set yet, then a default image is used. |
358 | - def profile_image(profile) | ||
359 | - image_tag(profile_icon(profile), :alt => profile.name(), :title => '' ) | 358 | + def profile_image(profile, size=:portrait, opt={}) |
359 | + opt[:alt] ||= profile.name() | ||
360 | + opt[:title] ||= '' | ||
361 | + image_tag(profile_icon(profile, size), opt ) | ||
360 | end | 362 | end |
361 | 363 | ||
362 | - def profile_icon(profile) | 364 | + def profile_icon( profile, size=:portrait ) |
363 | if profile.image | 365 | if profile.image |
364 | - profile.image.public_filename(:minor) | 366 | + profile.image.public_filename( size ) |
365 | else | 367 | else |
366 | if profile.organization? | 368 | if profile.organization? |
367 | if profile.kind_of?(Community) | 369 | if profile.kind_of?(Community) |
368 | - 'icons-app/users.png' | 370 | + '/images/icons-app/users_size-'+ size.to_s() +'.png' |
369 | else | 371 | else |
370 | - 'icons-app/gnome-home.png' | 372 | + '/images/icons-app/gnome-home_size-'+ size.to_s() +'.png' |
371 | end | 373 | end |
372 | else | 374 | else |
373 | - 'icons-app/user_icon.png' | 375 | + '/images/icons-app/user_icon_size-'+ size.to_s() +'.png' |
374 | end | 376 | end |
375 | end | 377 | end |
376 | 378 | ||
@@ -378,8 +380,8 @@ module ApplicationHelper | @@ -378,8 +380,8 @@ module ApplicationHelper | ||
378 | 380 | ||
379 | # displays a link to the profile homepage with its image (as generated by | 381 | # displays a link to the profile homepage with its image (as generated by |
380 | # #profile_image) and its name below it. | 382 | # #profile_image) and its name below it. |
381 | - def profile_image_link(profile) | ||
382 | - link_to( '<div>'+ profile_image(profile) +'</div><span>'+ profile.name() +'</span>', profile.url, | 383 | + def profile_image_link(profile, size=:portrait) |
384 | + link_to( '<div>'+ profile_image(profile, size) +'</div><span>'+ profile.name() +'</span>', profile.url, | ||
383 | :help => _('Click on this icon to go to the <b>%s</b>\'s home page') % profile.name ) | 385 | :help => _('Click on this icon to go to the <b>%s</b>\'s home page') % profile.name ) |
384 | end | 386 | end |
385 | 387 |
app/models/image.rb
@@ -5,7 +5,10 @@ class Image < ActiveRecord::Base | @@ -5,7 +5,10 @@ class Image < ActiveRecord::Base | ||
5 | :storage => :file_system, | 5 | :storage => :file_system, |
6 | :max_size => 500.kilobytes, | 6 | :max_size => 500.kilobytes, |
7 | :resize_to => '320x200>', | 7 | :resize_to => '320x200>', |
8 | - :thumbnails => { :thumb => '100x100>', :minor => '64x64>', :portrait => 'x95' , :icon => '20x20'} | 8 | + :thumbnails => { :thumb => '100x100', |
9 | + :portrait => '64x64', | ||
10 | + :minor => '50x50', | ||
11 | + :icon => '20x20!' } | ||
9 | 12 | ||
10 | validates_as_attachment | 13 | validates_as_attachment |
11 | end | 14 | end |
app/views/blocks/profile_info.rhtml
1 | <h2><%= block.owner.name %></h2> | 1 | <h2><%= block.owner.name %></h2> |
2 | 2 | ||
3 | -<div class="profile-info-picture"><%= profile_image(block.owner) %></div> | 3 | +<div class="profile-info-picture"><%= profile_image(block.owner, :thumb) %></div> |
4 | 4 | ||
5 | <ul class="profile-info-data"> | 5 | <ul class="profile-info-data"> |
6 | <li><%= _('Since %{year}/%{month}') % { :year => block.owner.created_at.year, :month => block.owner.created_at.month } %></li> | 6 | <li><%= _('Since %{year}/%{month}') % { :year => block.owner.created_at.year, :month => block.owner.created_at.month } %></li> |
app/views/content_viewer/_comment.rhtml
1 | -<div class'comment'> | 1 | +<div class="article-comment<%= |
2 | + ' comment-from-owner' if ( @page.profile.name == comment.author.name ) %>"> | ||
3 | + <%= link_to content_tag( 'span', comment.author.name() ), comment.author.url, | ||
4 | + :class => 'comment-picture', | ||
5 | + :style => 'background-image:url(%s)' % profile_icon(comment.author, :minor) %> | ||
2 | <h4><%= comment.title %></h4> | 6 | <h4><%= comment.title %></h4> |
3 | - <div><%= _('By %{author} on %{date}') % { :author => (comment.author ? comment.author.identifier : comment.name), :date => comment.created_on } %></div> | ||
4 | - <div> | 7 | + <div class="comment-info"> |
8 | + <%= _('By %{author} on %{date}') % { | ||
9 | + :author => link_to( | ||
10 | + (comment.author ? comment.author.identifier : comment.name), | ||
11 | + comment.author.url), | ||
12 | + :date => comment.created_on } %> | ||
13 | + </div> | ||
14 | + <div class="comment-text"> | ||
5 | <%= comment.body %> | 15 | <%= comment.body %> |
6 | </div> | 16 | </div> |
7 | </div> | 17 | </div> |
app/views/content_viewer/_comment_form.rhtml
@@ -5,7 +5,8 @@ | @@ -5,7 +5,8 @@ | ||
5 | class="post_comment_box closed" | 5 | class="post_comment_box closed" |
6 | onclick="f=$(<%= comment_form_id %>); f.style.display='block'; | 6 | onclick="f=$(<%= comment_form_id %>); f.style.display='block'; |
7 | this.className = this.className.replace(/closed/,'opened'); | 7 | this.className = this.className.replace(/closed/,'opened'); |
8 | - f.commit.focus(); f['comment[title]'].focus()"> | 8 | + f.commit.focus(); f['comment[title]'].focus(); |
9 | + this.onclick=null"> | ||
9 | 10 | ||
10 | <h4><%= _('Post a comment') %></h4> | 11 | <h4><%= _('Post a comment') %></h4> |
11 | 12 |
app/views/content_viewer/view_page.rhtml
1 | +<div class="article"> | ||
2 | + | ||
1 | <h2><%= @page.title %></h2> | 3 | <h2><%= @page.title %></h2> |
2 | 4 | ||
3 | -<div> | ||
4 | - <%= _('Tags: %s') % (@page.tags.map { |t| link_to(t, tag_url(:tag => t.name)) }.join(', ')) %> | 5 | +<% if logged_in? && current_user.person.has_permission?('post_content', profile) %> |
6 | +<div class="article-actions"> | ||
7 | + <%= link_to content_tag( 'span', _('Edit') ), | ||
8 | + { :controller => 'cms', :action => 'edit', :id => @page }, | ||
9 | + :class => 'button with-text icon-edit' %> | ||
10 | +</div> | ||
11 | +<% end %> | ||
12 | + | ||
13 | +<div class="article-tags"> | ||
14 | +<%= @page.tags.map { |t| link_to(t, tag_url(:tag => t.name)) }.join("\n") %> | ||
5 | </div> | 15 | </div> |
6 | 16 | ||
7 | <% if @page.parent && !@page.parent.path.blank? %> | 17 | <% if @page.parent && !@page.parent.path.blank? %> |
18 | +<div class="article-parent"> | ||
8 | <%= link_to_document(@page.parent, _('Up')) %> | 19 | <%= link_to_document(@page.parent, _('Up')) %> |
20 | +</div> | ||
9 | <% end %> | 21 | <% end %> |
10 | -<% if logged_in? && current_user.person.has_permission?('post_content', profile) %> | ||
11 | - <%= link_to _('Edit'), :controller => 'cms', :action => 'edit', :id => @page %> | ||
12 | -<% end %> | ||
13 | - | ||
14 | -<hr/> | ||
15 | 22 | ||
16 | <%= @page.to_html %> | 23 | <%= @page.to_html %> |
17 | 24 | ||
@@ -25,10 +32,13 @@ | @@ -25,10 +32,13 @@ | ||
25 | <% end %> | 32 | <% end %> |
26 | --> | 33 | --> |
27 | 34 | ||
28 | -<h3><%= _('Categories') %></h3> | ||
29 | - | ||
30 | -<%= @page.categories.map {|item| link_to_category(item) }.join(', ') %> | 35 | +<div class="article-cat"> |
36 | + <h3><%= _('Categories') %></h3> | ||
37 | + <%= @page.categories.map {|item| link_to_category(item) }.join(', ') %> | ||
38 | +</div> | ||
31 | 39 | ||
32 | <h3><%= @comments.size == 0 ? _('No comments yet') : (n_('One comment', '%{comments} comments', @comments.size)) % { :comments => @comments.size} %></h3> | 40 | <h3><%= @comments.size == 0 ? _('No comments yet') : (n_('One comment', '%{comments} comments', @comments.size)) % { :comments => @comments.size} %></h3> |
33 | <%= render :partial => 'comment', :collection => @comments %> | 41 | <%= render :partial => 'comment', :collection => @comments %> |
34 | <%= render :partial => 'comment_form' %> | 42 | <%= render :partial => 'comment_form' %> |
43 | + | ||
44 | +</div><!-- end class="article" --> |
public/designs/icons/default/style.css
1 | -.icon-edit { background-image: url(gtk-edit.png) } | 1 | +.icon-edit { background-image: url(edit-HC.gif) } |
2 | .icon-home { background-image: url(gnome-home.png) } | 2 | .icon-home { background-image: url(gnome-home.png) } |
3 | .icon-new { background-image: url(gtk-new.png) } | 3 | .icon-new { background-image: url(gtk-new.png) } |
4 | .icon-close { background-image: url(cancel-HC.gif) } | 4 | .icon-close { background-image: url(cancel-HC.gif) } |
public/designs/themes/default/stylesheets/blocks/environment-statistics-block.css
0 → 100644
@@ -0,0 +1,12 @@ | @@ -0,0 +1,12 @@ | ||
1 | + | ||
2 | +#content .environment-statistics-block .block-title { | ||
3 | + padding-left: 30px; | ||
4 | + font-size: 12px; | ||
5 | +} | ||
6 | + | ||
7 | +#content .environment-statistics-block ul { | ||
8 | + margin: 0px 0px 0px 5px; | ||
9 | +} | ||
10 | +.msie #content .environment-statistics-block ul { | ||
11 | + margin: 0px 0px 0px 45px; | ||
12 | +} |
public/designs/themes/default/stylesheets/blocks/main-block.css
0 → 100644
@@ -0,0 +1,91 @@ | @@ -0,0 +1,91 @@ | ||
1 | +.article { | ||
2 | + position: relative; | ||
3 | + text-align: justify; | ||
4 | +} | ||
5 | + | ||
6 | +.article-tags { | ||
7 | + text-align: right; | ||
8 | + font-size: 10px; | ||
9 | + margin-top: -9px; | ||
10 | + padding-right: 15px; | ||
11 | +} | ||
12 | + | ||
13 | +.article-tags a { | ||
14 | + color: #729FCF; | ||
15 | + border: 1px solid #B8CFE7; | ||
16 | + text-decoration: none; | ||
17 | + padding: 0px 2px 1px 2px; | ||
18 | +} | ||
19 | +.article-tags a:hover { | ||
20 | + color: #FFF; | ||
21 | + border: 1px solid #3465A4; | ||
22 | + background: #729FCF; | ||
23 | +} | ||
24 | + | ||
25 | +.article-actions { | ||
26 | + position: absolute; | ||
27 | + top: -5px; | ||
28 | + right: 0px; | ||
29 | + padding-right: 15px; | ||
30 | +} | ||
31 | + | ||
32 | +.article-parent { | ||
33 | + text-align: right; | ||
34 | + padding-right: 15px; | ||
35 | +} | ||
36 | + | ||
37 | +.article-cat { | ||
38 | + position: relative; | ||
39 | + border: 1px dotted #B8CFE7; | ||
40 | + margin-top: 10px; | ||
41 | + padding: 10px; | ||
42 | +} | ||
43 | + | ||
44 | +#content .article-cat h3 { | ||
45 | + margin: 0px 0px 5px 0px; | ||
46 | +} | ||
47 | + | ||
48 | +/* * * Comments * * */ | ||
49 | + | ||
50 | +.article-comment { | ||
51 | + position: relative; | ||
52 | + border: 1px solid #B8CFE7; | ||
53 | + margin-bottom: 10px; | ||
54 | + padding: 10px; | ||
55 | +} | ||
56 | + | ||
57 | +.comment-from-owner { | ||
58 | + border: 1px solid #3465A4; | ||
59 | + background: #B8CFE7; | ||
60 | +} | ||
61 | + | ||
62 | +#content .article-comment h4 { | ||
63 | + font-size: 14px; | ||
64 | + margin: 0px; | ||
65 | +} | ||
66 | + | ||
67 | +.comment-picture { | ||
68 | + position: relative; | ||
69 | + display: block; | ||
70 | + width: 50px; | ||
71 | + height: 50px; | ||
72 | + background-repeat: no-repeat; | ||
73 | + background-position: 50% 50%; | ||
74 | + margin-right: 10px; | ||
75 | + float: left; | ||
76 | +} | ||
77 | +.comment-picture span { | ||
78 | + display: none; | ||
79 | +} | ||
80 | + | ||
81 | +.comment-info { | ||
82 | + font-size: 10px; | ||
83 | + color: #999; | ||
84 | +} | ||
85 | +.comment-from-owner .comment-info { | ||
86 | + color: #729FCF; | ||
87 | +} | ||
88 | + | ||
89 | +.comment-text { | ||
90 | + clear: left; | ||
91 | +} |
public/designs/themes/default/stylesheets/blocks/profile-info-block.css
@@ -13,11 +13,11 @@ | @@ -13,11 +13,11 @@ | ||
13 | } | 13 | } |
14 | 14 | ||
15 | .profile-info-data { | 15 | .profile-info-data { |
16 | - width: 140px; | 16 | + width: 110px; |
17 | font-size: 10px; | 17 | font-size: 10px; |
18 | text-align: right; | 18 | text-align: right; |
19 | position: relative; | 19 | position: relative; |
20 | - top: 6px; | 20 | + top: 20px; |
21 | } | 21 | } |
22 | 22 | ||
23 | .profile-info-options { | 23 | .profile-info-options { |
public/designs/themes/default/stylesheets/blocks/recent-documents-block.css
0 → 100644
@@ -0,0 +1,12 @@ | @@ -0,0 +1,12 @@ | ||
1 | + | ||
2 | +#content .recent-documents-block .block-title { | ||
3 | + padding-left: 30px; | ||
4 | + font-size: 12px; | ||
5 | +} | ||
6 | + | ||
7 | +#content .recent-documents-block ul { | ||
8 | + margin: 0px 0px 0px 5px; | ||
9 | +} | ||
10 | +.msie #content .recent-documents-block ul { | ||
11 | + margin: 0px 0px 0px 45px; | ||
12 | +} |
900 Bytes
2.79 KB
3.44 KB
8.12 KB
4.96 KB
8.62 KB
@@ -0,0 +1,137 @@ | @@ -0,0 +1,137 @@ | ||
1 | +<?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
2 | +<!-- Created with Inkscape (http://www.inkscape.org/) --> | ||
3 | +<svg | ||
4 | + xmlns:dc="http://purl.org/dc/elements/1.1/" | ||
5 | + xmlns:cc="http://creativecommons.org/ns#" | ||
6 | + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" | ||
7 | + xmlns:svg="http://www.w3.org/2000/svg" | ||
8 | + xmlns="http://www.w3.org/2000/svg" | ||
9 | + xmlns:xlink="http://www.w3.org/1999/xlink" | ||
10 | + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" | ||
11 | + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" | ||
12 | + width="200" | ||
13 | + height="200" | ||
14 | + id="svg2" | ||
15 | + sodipodi:version="0.32" | ||
16 | + inkscape:version="0.45+devel" | ||
17 | + version="1.0" | ||
18 | + sodipodi:docname="bg-tags.svg" | ||
19 | + inkscape:output_extension="org.inkscape.output.svg.inkscape" | ||
20 | + inkscape:export-filename="/home/aurium/noosfero/public/img-source/bg-tags.png" | ||
21 | + inkscape:export-xdpi="90" | ||
22 | + inkscape:export-ydpi="90"> | ||
23 | + <defs | ||
24 | + id="defs4"> | ||
25 | + <linearGradient | ||
26 | + inkscape:collect="always" | ||
27 | + id="linearGradient3179"> | ||
28 | + <stop | ||
29 | + style="stop-color:#ffffff;stop-opacity:1" | ||
30 | + offset="0" | ||
31 | + id="stop3181" /> | ||
32 | + <stop | ||
33 | + style="stop-color:#000000;stop-opacity:1" | ||
34 | + offset="1" | ||
35 | + id="stop3183" /> | ||
36 | + </linearGradient> | ||
37 | + <linearGradient | ||
38 | + inkscape:collect="always" | ||
39 | + id="linearGradient3169"> | ||
40 | + <stop | ||
41 | + style="stop-color:#3465a4;stop-opacity:0.6" | ||
42 | + offset="0" | ||
43 | + id="stop3171" /> | ||
44 | + <stop | ||
45 | + style="stop-color:#729fcf;stop-opacity:0;" | ||
46 | + offset="1" | ||
47 | + id="stop3173" /> | ||
48 | + </linearGradient> | ||
49 | + <inkscape:perspective | ||
50 | + sodipodi:type="inkscape:persp3d" | ||
51 | + inkscape:vp_x="-50 : 600 : 1" | ||
52 | + inkscape:vp_y="0 : 1000 : 0" | ||
53 | + inkscape:vp_z="700 : 600 : 1" | ||
54 | + inkscape:persp3d-origin="300 : 400 : 1" | ||
55 | + id="perspective10" /> | ||
56 | + <linearGradient | ||
57 | + inkscape:collect="always" | ||
58 | + xlink:href="#linearGradient3169" | ||
59 | + id="linearGradient3175" | ||
60 | + x1="0" | ||
61 | + y1="200" | ||
62 | + x2="137" | ||
63 | + y2="200" | ||
64 | + gradientUnits="userSpaceOnUse" /> | ||
65 | + <linearGradient | ||
66 | + inkscape:collect="always" | ||
67 | + xlink:href="#linearGradient3179" | ||
68 | + id="linearGradient3185" | ||
69 | + x1="0" | ||
70 | + y1="200" | ||
71 | + x2="133" | ||
72 | + y2="200" | ||
73 | + gradientUnits="userSpaceOnUse" /> | ||
74 | + <linearGradient | ||
75 | + inkscape:collect="always" | ||
76 | + xlink:href="#linearGradient3179" | ||
77 | + id="linearGradient3197" | ||
78 | + gradientUnits="userSpaceOnUse" | ||
79 | + x1="0" | ||
80 | + y1="200" | ||
81 | + x2="133" | ||
82 | + y2="200" /> | ||
83 | + <mask | ||
84 | + maskUnits="userSpaceOnUse" | ||
85 | + id="mask3193"> | ||
86 | + <rect | ||
87 | + style="opacity:1;fill:url(#linearGradient3197);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" | ||
88 | + id="rect3195" | ||
89 | + width="200" | ||
90 | + height="200" | ||
91 | + x="0" | ||
92 | + y="0" /> | ||
93 | + </mask> | ||
94 | + </defs> | ||
95 | + <sodipodi:namedview | ||
96 | + id="base" | ||
97 | + pagecolor="#ffffff" | ||
98 | + bordercolor="#666666" | ||
99 | + borderopacity="1.0" | ||
100 | + inkscape:pageopacity="0.0" | ||
101 | + inkscape:pageshadow="2" | ||
102 | + inkscape:zoom="1" | ||
103 | + inkscape:cx="100" | ||
104 | + inkscape:cy="100" | ||
105 | + inkscape:document-units="px" | ||
106 | + inkscape:current-layer="layer1" | ||
107 | + showgrid="false" | ||
108 | + inkscape:window-width="1024" | ||
109 | + inkscape:window-height="708" | ||
110 | + inkscape:window-x="0" | ||
111 | + inkscape:window-y="26" /> | ||
112 | + <metadata | ||
113 | + id="metadata7"> | ||
114 | + <rdf:RDF> | ||
115 | + <cc:Work | ||
116 | + rdf:about=""> | ||
117 | + <dc:format>image/svg+xml</dc:format> | ||
118 | + <dc:type | ||
119 | + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> | ||
120 | + </cc:Work> | ||
121 | + </rdf:RDF> | ||
122 | + </metadata> | ||
123 | + <g | ||
124 | + inkscape:label="Camada 1" | ||
125 | + inkscape:groupmode="layer" | ||
126 | + id="layer1"> | ||
127 | + <rect | ||
128 | + style="opacity:1;fill:url(#linearGradient3175);fill-opacity:1;fill-rule:evenodd;stroke:#204a87;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" | ||
129 | + id="rect2389" | ||
130 | + width="250" | ||
131 | + height="198" | ||
132 | + x="1" | ||
133 | + y="1" | ||
134 | + ry="10" | ||
135 | + mask="url(#mask3193)" /> | ||
136 | + </g> | ||
137 | +</svg> |
public/stylesheets/blocks/profile-info-block.css
@@ -13,8 +13,9 @@ | @@ -13,8 +13,9 @@ | ||
13 | margin: 0px; | 13 | margin: 0px; |
14 | } | 14 | } |
15 | 15 | ||
16 | -.profile-info-block li { | 16 | +#content .profile-info-block ul li { |
17 | list-style: none; | 17 | list-style: none; |
18 | + list-style-image: none; | ||
18 | margin: 0px; | 19 | margin: 0px; |
19 | padding: 2px; | 20 | padding: 2px; |
20 | } | 21 | } |
public/stylesheets/blocks/profile-list-block.css
public/stylesheets/common.css
@@ -336,6 +336,11 @@ body.category4 #content h4, body.category4 #content h5, body.category4 #content | @@ -336,6 +336,11 @@ body.category4 #content h4, body.category4 #content h5, body.category4 #content | ||
336 | margin: 0px 0px 10px 0px; | 336 | margin: 0px 0px 10px 0px; |
337 | } | 337 | } |
338 | 338 | ||
339 | +#content ul li { | ||
340 | + list-style: url(/images/list-dot.gif); | ||
341 | +} | ||
342 | + | ||
343 | + | ||
339 | #better-browser-promotion { | 344 | #better-browser-promotion { |
340 | position: absolute; | 345 | position: absolute; |
341 | top: 100px; | 346 | top: 100px; |
@@ -0,0 +1,43 @@ | @@ -0,0 +1,43 @@ | ||
1 | +#!/bin/bash | ||
2 | + | ||
3 | +if ! cd public/images/0000; then | ||
4 | + echo " | ||
5 | + Rode esse script na raiz do Noosfero para ele redimensionar as | ||
6 | + imagens dos usuarios. | ||
7 | + " | ||
8 | + exit 1 | ||
9 | +fi | ||
10 | + | ||
11 | +echo " | ||
12 | + Ok! We are on $(pwd) | ||
13 | +" | ||
14 | + | ||
15 | +thumb='100x100' | ||
16 | +portrait='64x64' | ||
17 | +minor='50x50' | ||
18 | +icon='20x20!' | ||
19 | +lista='thumb | ||
20 | +portrait | ||
21 | +minor' | ||
22 | +# Padrao: <nome>_<tamanho>.<ext> | ||
23 | + | ||
24 | +for s in $lista icon; do | ||
25 | + echo "Deletando tamanho $s" | ||
26 | + find . -name "*_$s.*" | xargs -L 1 -I{} rm '{}' | ||
27 | +done | ||
28 | + | ||
29 | +find . -type f | | ||
30 | +while read img; do | ||
31 | + for s in $lista; do | ||
32 | + sN=$( eval "echo \$$s" ) | ||
33 | + echo "Criando tamanho $s ($sN) para $img" | ||
34 | + name=$( echo "$img" | sed 's/^\(.*\)\.[^\.]\+$/\1/' ) | ||
35 | + ext=$( echo "$img" | sed 's/^.*\.\([^\.]\+\)$/\1/' ) | ||
36 | + convert "$img" -resize $sN "${name}_${s}.$ext" | ||
37 | + done | ||
38 | + echo "Criando tamanho icon ($icon) para $img" | ||
39 | + convert -size $thumb xc:black -gravity Center \ | ||
40 | + -draw "image over 0,0 0,0 '${name}_thumb.$ext'" \ | ||
41 | + -resize $icon "${name}_icon.$ext" | ||
42 | +done | ||
43 | + |