このコミットが含まれているのは:
@@ -18,14 +18,12 @@ class PreviewController < ApplicationController
|
||||
def thumbnail
|
||||
return render_bad_request('URL は必須です.') if params[:url].blank?
|
||||
|
||||
image = MiniMagick::Image.read(Preview::ThumbnailFetcher.fetch(params[:url]))
|
||||
image.auto_orient
|
||||
image.resize '180x180>'
|
||||
image.format 'png'
|
||||
width, height = image.dimensions
|
||||
raise Preview::ThumbnailFetcher::GenerationFailed, 'サムネール画像の変換に失敗しました.' if width > 180 || height > 180
|
||||
|
||||
send_data image.to_blob, type: 'image/png', disposition: 'inline'
|
||||
attachment =
|
||||
Post.resized_thumbnail_attachment(
|
||||
StringIO.new(Preview::ThumbnailFetcher.fetch(params[:url])))
|
||||
send_data attachment[:io].read,
|
||||
type: attachment[:content_type],
|
||||
disposition: 'inline'
|
||||
rescue Preview::UrlSafety::UnsafeUrl => e
|
||||
render_bad_request(e.message)
|
||||
rescue Preview::HttpFetcher::FetchTimeout => e
|
||||
|
||||
新しい課題から参照
ユーザをブロックする