문제

저는 자체로운 보판 체 시스템을 사용하고 있습니다. 이것은 rmagick을 사용하고 Rmagick은 ImageList와 함께 제공됩니다. 기존 코드는 다음과 같습니다.

  im = ImageList.new("#{@@captcha_image_path}/#{captcha.pos}.JPG")
  @imgdata = im.to_blob

    send_data(@imgdata, :filename => 'captcha.jpg', 
                        :type => 'image/jpeg', 
                        :disposition => 'inline', 
                        :nocache => Time.zone.now)   

위의 코드는 잘 작동합니다.

이제 우리는 rmagick을 제거하고 Minimagick을 사용하고 있습니다. 우리는 여기에 무작위로 표시 될 몇 가지 이미지를 생성했습니다. 이제 ImageList에 액세스 할 수 없었기 때문에 Blob 데이터를 보내는 방법이 궁금했습니다. 구체적으로 ImageList를 사용하여 @imgdata를 어떻게 얻습니까?

도움이 되었습니까?

해결책

send_file '/path/to/image/file.jpg', :type=>"application/jpeg"
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top