mirror of
https://github.com/openSUSE/osem.git
synced 2026-08-13 19:54:02 +00:00
Gracefully fail out of image handling in ticket PDF
(cherry picked from commit 730d53c8b6)
This commit is contained in:
parent
6c85df603c
commit
4d4ef597dc
1 changed files with 8 additions and 4 deletions
|
|
@ -49,7 +49,11 @@ class TicketPdf < Prawn::Document
|
|||
if @conference.picture?
|
||||
conference_image = case @conference.picture.ticket.url[0, 4]
|
||||
when 'http', 'ftp:' # CDNs
|
||||
open(@conference.picture.ticket.url)
|
||||
begin
|
||||
open(@conference.picture.ticket.url)
|
||||
rescue OpenURI::HTTPError
|
||||
nil
|
||||
end
|
||||
when '/sys' # local storage
|
||||
open([
|
||||
Rails.root,
|
||||
|
|
@ -57,10 +61,10 @@ class TicketPdf < Prawn::Document
|
|||
@conference.picture.ticket.url
|
||||
].join)
|
||||
end
|
||||
image conference_image, at: [@mid_horizontal + 30, cursor]
|
||||
else
|
||||
image "#{Rails.root}/public/img/osem-logo.png", at: [@mid_horizontal + 30, cursor], height: 70
|
||||
end
|
||||
conference_image ||= open("#{Rails.root}/public/img/osem-logo.png")
|
||||
image conference_image, at: [@mid_horizontal + 30, cursor], fit: [200, 70]
|
||||
|
||||
move_down 70
|
||||
draw_text @conference.title.to_s, at: [@mid_horizontal + 30, cursor - 30], size: 12
|
||||
draw_text @conference.organization.name.to_s, at: [@mid_horizontal + 30, cursor - 50], size: 12
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue