Fix bug.
This commit is contained in:
parent
64e26d9e2e
commit
04da5dfc7e
|
@ -73,12 +73,16 @@ class AdImage
|
||||||
def youtube_thumb
|
def youtube_thumb
|
||||||
uri = URI.parse(self.youtube) rescue nil
|
uri = URI.parse(self.youtube) rescue nil
|
||||||
if !uri.nil? && uri.host == "www.youtube.com"
|
if !uri.nil? && uri.host == "www.youtube.com"
|
||||||
params = CGI.parse(uri.query)
|
params = CGI.parse(uri.query) rescue {}
|
||||||
|
if params.has_key?('v')
|
||||||
v = params['v'].first
|
v = params['v'].first
|
||||||
return "http://img.youtube.com/vi/#{v}/0.jpg"
|
return "http://img.youtube.com/vi/#{v}/0.jpg"
|
||||||
else
|
else
|
||||||
return ""
|
return ""
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
return ""
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
protected
|
protected
|
||||||
|
|
Loading…
Reference in New Issue