• R/O
  • HTTP
  • SSH
  • HTTPS

pettanr: コミット

サーバ側、Railsシステム本体


コミットメタ情報

リビジョン032c2dca80385c0d332b3cec1678321b7890d0f0 (tree)
日時2012-08-05 17:35:54
作者yasushiito <yas@pen-...>
コミッターyasushiito

ログメッセージ

t#29183#29182:add magic number for thumbnail

変更サマリ

差分

--- a/app/models/resource_picture.rb
+++ b/app/models/resource_picture.rb
@@ -70,7 +70,7 @@ class ResourcePicture < ActiveRecord::Base
7070 end
7171
7272 def thumbnail(rimg)
73- tw, th = ResourcePicture.fix_size_both(64, 64, rimg.columns, rimg.rows)
73+ tw, th = ResourcePicture.fix_size_both(MagicNumber['thumbnail_width'], MagicNumber['thumbnail_height'], rimg.columns, rimg.rows)
7474 ResourcePicture.resize(rimg.to_blob, tw, th).to_blob
7575 end
7676
--- /dev/null
+++ b/app/views/original_picture_license_groups/_allform.html.erb
@@ -0,0 +1,24 @@
1+<%= form_for(@original_picture_license_group) do |f| %>
2+ <% if @original_picture_license_group.errors.any? %>
3+ <div id="error_explanation">
4+ <h2><%= pluralize(@original_picture_license_group.errors.count, "error") %> prohibited this comic from being saved:</h2>
5+
6+ <ul>
7+ <% @original_picture_license_group.errors.full_messages.each do |msg| %>
8+ <li><%= msg %></li>
9+ <% end %>
10+ </ul>
11+ </div>
12+ <% end %>
13+
14+ <div class="field">
15+ <%= f.label :license_group_id %><br />
16+ <%= f.collection_select :license_group_id, LicenseGroup.list.map {|l| [l.caption, l.id] }, :last, :first %>
17+ <%= f.hidden_field :original_picture_id %>
18+ </div>
19+ <%= hidden_field_tag :original_picture_id, @original_picture.id %>
20+
21+ <div class="actions">
22+ <%= f.submit %>
23+ </div>
24+<% end %>
--- a/app/views/resource_pictures/index.html.erb
+++ b/app/views/resource_pictures/index.html.erb
@@ -3,7 +3,7 @@
33 <% @resource_picture = resource_picture %>
44 <div>
55 <%= link_to resource_picture.filename, resource_picture_path(resource_picture) %>
6- <img src="<%= resource_picture.url -%>">
6+ <%= tag :img, :src => resource_picture.url, :width => MagicNumber['thumbnail_width'], :height => MagicNumber['thumbnail_height'] %>
77 <%= resource_picture.width %>x<%= resource_picture.height %>
88 <%= resource_picture.filesize %>bytes
99 <%= render resource_picture.credit_template, :picture => resource_picture %>
--- a/config/application.rb
+++ b/config/application.rb
@@ -67,7 +67,7 @@ config.assets.initialize_on_precompile = false
6767 end
6868 end
6969 Pettanr::Application.licenses = YAML.load(open(Rails.root + 'config/license.yml').read)
70-
70+MagicNumber = YAML.load(open(Rails.root + 'config/magic_number.yml').read)
7171 y = YAML.load(open(Rails.root + 'config/picture_io.yml').read)
7272 require y[Rails.env]["adapter"]
7373 pio = PictureIO.const_get y[Rails.env]["io"]
--- /dev/null
+++ b/config/magic_number.yml
@@ -0,0 +1,2 @@
1+ thumbnail_width: 64
2+ thumbnail_height: 64
旧リポジトリブラウザで表示