3

我有这个配置的典型设置,没什么特别的,就像本教程中的一样:http: //shareyourtechskills.blogspot.com/2011/01/jcrop-with-paper-clip-plugin.html

上传头像 - 工作,但是当我裁剪它时,进程卡在循环中,控制台中出现以下错误:

convert: GeometryDoesNotContainImage `/var/folders/4p/v_37jqkj6810y7wsd8b7ly100000gn/T/38361898520121013-26133-1cbz90w20121013-26133-1x1vcii20121013-26133-gjlod.png' @ warning/transform.c/CropImage/572.
convert: GeometryDoesNotContainImage `/var/folders/4p/v_37jqkj6810y7wsd8b7ly100000gn/T/38361898520121013-26133-fwu1jt.jpg' @ warning/transform.c/CropImage/572.
convert: GeometryDoesNotContainImage `/var/folders/4p/v_37jqkj6810y7wsd8b7ly100000gn/T/38361898520121013-26133-fwu1jt20121013-26133-1p255t220121013-26133-i8ny07.png' @ warning/transform.c/CropImage/572.
convert: GeometryDoesNotContainImage `/var/folders/4p/v_37jqkj6810y7wsd8b7ly100000gn/T/38361898520121013-26133-18wr3op.jpg' @ warning/transform.c/CropImage/572.
convert: GeometryDoesNotContainImage `/var/folders/4p/v_37jqkj6810y7wsd8b7ly100000gn/T/38361898520121013-26133-18wr3op20121013-26133-kp6o120121013-26133-1ut9jfy.png' @ warning/transform.c/CropImage/572.
convert: GeometryDoesNotContainImage `/var/folders/4p/v_37jqkj6810y7wsd8b7ly100000gn/T/38361898520121013-26133-1hjxk9x.jpg' @ warning/transform.c/CropImage/572.
convert: GeometryDoesNotContainImage `/var/folders/4p/v_37jqkj6810y7wsd8b7ly100000gn/T/38361898520121013-26133-1hjxk9x20121013-26133-rjrf8c20121013-26133-1eyrpxv.png' @ warning/transform.c/CropImage/572.
convert: GeometryDoesNotContainImage `/var/folders/4p/v_37jqkj6810y7wsd8b7ly100000gn/T/38361898520121013-26133-6h4lu.jpg' @ warning/transform.c/CropImage/572.

这个字符串大约有 500 个,然后我得到这个:

Started PUT "/users/1" for 127.0.0.1 at 2012-10-13 00:34:24 +0300
Processing by UsersController#update as HTML
  Parameters: {"utf8"=>"✓", "authenticity_token"=>"ht7YiTS5yOqXFy0EWeFVLBfv5eZU0codQfR8DvlKHA=", "user"=>{"crop_x"=>"223", "crop_y"=>"113", "crop_w"=>"145", "crop_h"=>"145"}, "commit"=>"Сохранить", "id"=>"1"}
  User Load (0.2ms)  SELECT "users".* FROM "users" WHERE "users"."id" = 1 LIMIT 1
  User Load (0.1ms)  SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1  [["id", "1"]]
  CACHE (0.0ms)  SELECT "users".* FROM "users" WHERE "users"."id" = ? LIMIT 1
   (0.0ms)  begin transaction
  User Exists (0.1ms)  SELECT 1 FROM "users" WHERE (LOWER("users"."email") = LOWER('example@example.com') AND "users"."id" != 1) LIMIT 1
Command :: identify -format %wx%h '/var/folders/4p/v_37jqkj6810y7wsd8b7ly100000gn/T/38361898520121013-26133-10hxtsn.jpg[0]'
Command :: convert '/var/folders/4p/v_37jqkj6810y7wsd8b7ly100000gn/T/38361898520121013-26133-10hxtsn.jpg[0]' -crop 145x145+223+113 -auto-orient -resize "145x" +repage '/var/folders/4p/v_37jqkj6810y7wsd8b7ly100000gn/T/38361898520121013-26133-10hxtsn20121013-26133-1hplq8v.png'
Command :: identify -format %wx%h '/var/folders/4p/v_37jqkj6810y7wsd8b7ly100000gn/T/38361898520121013-26133-10hxtsn20121013-26133-1hplq8v20121013-26133-m37pe.png[0]'
Command :: identify -format %m '/var/folders/4p/v_37jqkj6810y7wsd8b7ly100000gn/T/38361898520121013-26133-10hxtsn20121013-26133-1hplq8v20121013-26133-m37pe.png[0]'
Command :: identify -format %m '/var/folders/4p/v_37jqkj6810y7wsd8b7ly100000gn/T/38361898520121013-26133-10hxtsn20121013-26133-1hplq8v20121013-26133-m37pe.png[0]'
Command :: convert '/var/folders/4p/v_37jqkj6810y7wsd8b7ly100000gn/T/38361898520121013-26133-10hxtsn20121013-26133-1hplq8v20121013-26133-m37pe.png[0]' -crop 145x145+223+113 -auto-orient -resize "50x" +repage '/var/folders/4p/v_37jqkj6810y7wsd8b7ly100000gn/T/38361898520121013-26133-10hxtsn20121013-26133-1hplq8v20121013-26133-m37pe20121013-26133-nkvpon'
Command :: file -b --mime '/var/folders/4p/v_37jqkj6810y7wsd8b7ly100000gn/T/38361898520121013-26133-10hxtsn20121013-26133-1hplq8v20121013-26133-m37pe20121013-26133-nkvpon'
  CACHE (0.0ms)  SELECT 1 FROM "users" WHERE (LOWER("users"."email") = LOWER('inc@gnezdom.com') AND "users"."id" != 1) LIMIT 1
Command :: identify -format %wx%h '/var/folders/4p/v_37jqkj6810y7wsd8b7ly100000gn/T/38361898520121013-26133-1hut940.jpg[0]'
Command :: convert '/var/folders/4p/v_37jqkj6810y7wsd8b7ly100000gn/T/38361898520121013-26133-1hut940.jpg[0]' -crop 145x145+223+113 -auto-orient -resize "145x" +repage '/var/folders/4p/v_37jqkj6810y7wsd8b7ly100000gn/T/38361898520121013-26133-1hut94020121013-26133-1k0w0qh.png'
Command :: identify -format %wx%h '/var/folders/4p/v_37jqkj6810y7wsd8b7ly100000gn/T/38361898520121013-26133-1hut94020121013-26133-1k0w0qh20121013-26133-69pm09.png[0]'
Command :: identify -format %m '/var/folders/4p/v_37jqkj6810y7wsd8b7ly100000gn/T/38361898520121013-26133-1hut94020121013-26133-1k0w0qh20121013-26133-69pm09.png[0]'
Command :: identify -format %m '/var/folders/4p/v_37jqkj6810y7wsd8b7ly100000gn/T/38361898520121013-26133-1hut94020121013-26133-1k0w0qh20121013-26133-69pm09.png[0]'
Command :: convert '/var/folders/4p/v_37jqkj6810y7wsd8b7ly100000gn/T/38361898520121013-26133-1hut94020121013-26133-1k0w0qh20121013-26133-69pm09.png[0]' -crop 145x145+223+113 -auto-orient -resize "50x" +repage '/var/folders/4p/v_37jqkj6810y7wsd8b7ly100000gn/T/38361898520121013-26133-1hut94020121013-26133-1k0w0qh20121013-26133-69pm0920121013-26133-2rw91z'
Command :: file -b --mime '/var/folders/4p/v_37jqkj6810y7wsd8b7ly100000gn/T/38361898520121013-26133-1hut94020121013-26133-1k0w0qh20121013-26133-69pm0920121013-26133-2rw91z'

也在 500 左右,然后我在浏览器中收到此错误:

SystemStackError in UsersController#update
stack level too deep

我很感兴趣为什么有这么多图片,如果我只修剪一张?谢谢

4

1 回答 1

5

大多数文章已经过时并且与当前版本的回形针和导轨不兼容,因此此配置需要重新组织,如此评论中所述http://railscasts.com/episodes/182-cropping-images?view=comments#comment_160006 Fona 说, 那

    avatar.reprocess!

必须不是从模型调用,而是从这样的控制器调用:

    @user.avatar.reprocess!

当然,您需要验证它是否存在裁剪变量,例如crop_x 和其他 PS Thx,Fona 以供您发表评论。

于 2012-10-13T13:52:31.703 回答