1

我尝试创建一个带有照片字段的refinerycms 引擎,并在渲染带有图像的页面时遇到了这个问题。

我搜索了没有结果的答案。

ArgumentError (Didn't recognise the geometry string ):
  dragonfly (0.9.15) lib/dragonfly/image_magick/processor.rb:104:in `thumb'
  dragonfly (0.9.15) lib/dragonfly/function_manager.rb:39:in `call'
  dragonfly (0.9.15) lib/dragonfly/function_manager.rb:39:in `block (2 levels) in call_last'
  dragonfly (0.9.15) lib/dragonfly/function_manager.rb:38:in `catch'
  dragonfly (0.9.15) lib/dragonfly/function_manager.rb:38:in `block in call_last'
  dragonfly (0.9.15) lib/dragonfly/function_manager.rb:37:in `each'
  dragonfly (0.9.15) lib/dragonfly/function_manager.rb:37:in `call_last'
  dragonfly (0.9.15) lib/dragonfly/processor.rb:5:in `process'
  dragonfly (0.9.15) lib/dragonfly/job.rb:79:in `apply'
  dragonfly (0.9.15) lib/dragonfly/job.rb:268:in `block in apply'
  dragonfly (0.9.15) lib/dragonfly/job.rb:268:in `each'
  dragonfly (0.9.15) lib/dragonfly/job.rb:268:in `apply'
  dragonfly (0.9.15) lib/dragonfly/response.rb:25:in `to_response'
  dragonfly (0.9.15) lib/dragonfly/server.rb:43:in `block in call'
  dragonfly (0.9.15) lib/dragonfly/server.rb:39:in `catch'
  dragonfly (0.9.15) lib/dragonfly/server.rb:39:in `call'
  journey (1.0.4) lib/journey/router.rb:68:in `block in call'
  journey (1.0.4) lib/journey/router.rb:56:in `each'
  journey (1.0.4) lib/journey/router.rb:56:in `call'
  actionpack (3.2.13) lib/action_dispatch/routing/route_set.rb:612:in `call'
  railties (3.2.13) lib/rails/engine.rb:479:in `call'
  railties (3.2.13) lib/rails/railtie/configurable.rb:30:in `method_missing'
  journey (1.0.4) lib/journey/router.rb:68:in `block in call'
  journey (1.0.4) lib/journey/router.rb:56:in `each'
  journey (1.0.4) lib/journey/router.rb:56:in `call'
  actionpack (3.2.13) lib/action_dispatch/routing/route_set.rb:612:in `call'
  warden (1.2.3) lib/warden/manager.rb:35:in `block in call'
  warden (1.2.3) lib/warden/manager.rb:34:in `catch'
  warden (1.2.3) lib/warden/manager.rb:34:in `call'
  actionpack (3.2.13) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
  rack (1.4.5) lib/rack/etag.rb:23:in `call'
  rack (1.4.5) lib/rack/conditionalget.rb:25:in `call'
  actionpack (3.2.13) lib/action_dispatch/middleware/head.rb:14:in `call'
  actionpack (3.2.13) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
  actionpack (3.2.13) lib/action_dispatch/middleware/flash.rb:242:in `call'
  rack (1.4.5) lib/rack/session/abstract/id.rb:210:in `context'
  rack (1.4.5) lib/rack/session/abstract/id.rb:205:in `call'
  actionpack (3.2.13) lib/action_dispatch/middleware/cookies.rb:341:in `call'
  dragonfly (0.9.15) lib/dragonfly/cookie_monster.rb:9:in `call'
  activerecord (3.2.13) lib/active_record/query_cache.rb:64:in `call'
  activerecord (3.2.13) lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in `call'
  actionpack (3.2.13) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
  activesupport (3.2.13) lib/active_support/callbacks.rb:405:in `_run__2453851283421214568__call__3206204981088823143__callbacks'
  activesupport (3.2.13) lib/active_support/callbacks.rb:405:in `__run_callback'
  activesupport (3.2.13) lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
  activesupport (3.2.13) lib/active_support/callbacks.rb:81:in `run_callbacks'
  actionpack (3.2.13) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
  actionpack (3.2.13) lib/action_dispatch/middleware/reloader.rb:65:in `call'
  actionpack (3.2.13) lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
  actionpack (3.2.13) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
  actionpack (3.2.13) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
  railties (3.2.13) lib/rails/rack/logger.rb:32:in `call_app'
  railties (3.2.13) lib/rails/rack/logger.rb:16:in `block in call'
  activesupport (3.2.13) lib/active_support/tagged_logging.rb:22:in `tagged'
  railties (3.2.13) lib/rails/rack/logger.rb:16:in `call'
  actionpack (3.2.13) lib/action_dispatch/middleware/request_id.rb:22:in `call'
  rack (1.4.5) lib/rack/methodoverride.rb:21:in `call'
  rack (1.4.5) lib/rack/runtime.rb:17:in `call'
  activesupport (3.2.13) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
  rack (1.4.5) lib/rack/lock.rb:15:in `call'
  actionpack (3.2.13) lib/action_dispatch/middleware/static.rb:63:in `call'
  railties (3.2.13) lib/rails/engine.rb:479:in `call'
  railties (3.2.13) lib/rails/application.rb:223:in `call'
  rack (1.4.5) lib/rack/content_length.rb:14:in `call'
  railties (3.2.13) lib/rails/rack/log_tailer.rb:17:in `call'
  rack (1.4.5) lib/rack/handler/webrick.rb:59:in `service'

这是代码,但它是由炼油厂使用以下命令生成的:

rails g refinery:engine car name:string description:string photo:image

这是控制器:

 def show
    @car = Car.find(params[:id])
    present(@page)
  end

这是视图:

<% content_for :body_content_title do %>
  <%= @car.name %>
<% end %>

<% content_for :body do %>
  <section>
    <h1>Name</h1>
    <p>
      <%=raw @car.name %>
    </p>
  </section>
  <section>
    <h1>Description</h1>
    <p>
      <%=raw @car.description %>
    </p>
  </section>
  <section>
    <h1>Photo</h1>

    <p>
      <%= image_fu @car.photo, nil %>
    </p>
  </section>
<% end %>

<% content_for :side_body do %>
  <aside>
    <h2><%= t('.other') %></h2>
    <ul id="cars">
      <% @cars.each do |car| %>
        <li>
          <%= link_to car.name, refinery.cars_car_path(car) %>
        </li>
      <% end %>
    </ul>
  </aside>
<% end %>

<%= render '/refinery/content_page' %>

这是一个模型:

module Refinery
  module Cars
    class Car < Refinery::Core::BaseModel
      self.table_name = 'refinery_cars'

      attr_accessible :name, :description, :photo_id, :position

      validates :name, :presence => true, :uniqueness => true

      belongs_to :photo, :class_name => '::Refinery::Image'
    end
  end
end

带有图像的页面的一部分

4

2 回答 2

2

如果您想在不指定大小的情况下显示图像,请尝试以下操作:

<%= image_tag @car.photo.url %>
于 2013-10-10T18:17:04.493 回答
2

这解决了问题:

<%= image_fu(@car.photo, "300x300")%>

感谢您的帮助。

于 2013-08-29T22:51:46.017 回答