Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/67.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails Rails peperclip-帮助裁剪图像_Ruby On Rails_Imagemagick - Fatal编程技术网

Ruby on rails Rails peperclip-帮助裁剪图像

Ruby on rails Rails peperclip-帮助裁剪图像,ruby-on-rails,imagemagick,Ruby On Rails,Imagemagick,欢迎,帮助裁剪图像 已附加文件:图像,样式:{show:'540x505} 根据需要修剪,但居中(向上),我需要图像不居中,并修剪顶部 原始图像: 需要: 定义曲别针样式时,您希望将选项设置为北。类似于 已附加文件:图像, 样式:{show:'540x505'}, 转换选项:{show:'-重力北'} 请参阅文档和示例用法。回答: has_attached_file :image, styles: { show: '' }, convert_options:

欢迎,帮助裁剪图像

已附加文件:图像,样式:{show:'540x505}

根据需要修剪,但居中(向上),我需要图像不居中,并修剪顶部

原始图像:

需要:

定义曲别针样式时,您希望将选项设置为。类似于

已附加文件:图像,
样式:{show:'540x505'},
转换选项:{show:'-重力北'}
请参阅文档和示例用法。

回答:

has_attached_file :image, styles: { show: '' },
                convert_options: {show: '-gravity north -thumbnail 540x505^ -extent 540x505' }