User Tag List
Results 1 to 2 of 2
- Join Date
- Nov 2005
- 1
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
send_data crashing WEBrick (sometimes)
I have an action with the following view, which seems to be crashing
WEBrick.
Code:
<%= render_component :controller => 'picture', :action => 'show', :id => 1 %> <img src="/images/artgallery.jpg" /> <%= render_component :controller => 'picture', :action => 'show', :id => 2 %>
that returns the image data. If I remove the <img
src="/images/artgallery.jpg" /> tag, this does not occur. Nor does it
occur if both components are given the same id argument (display the
same image).
Often the page will load the first time, but upon refresh the two images
from the component calls will not display and WEBrick will stop
responding.
The 'show' action:
Code:
def show @picture_id = params[:id] render :layout => false end
Code:
<img src="<%= url_for(:controller => 'picture', :action => 'picture', :id => @picture_id) %>" />
Code:
def picture picture = Picture.find(params[:id]) send_data(picture.data, :filename => picture.id, :type => "image/jpeg", :disposition => "inline") end
Code:
def data Magick::Image.read(get_root + "/" + get_filename).first.to_blob end
- Join Date
- Jul 2004
- Location
- Gerodieville Central, UK
- 446
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
I dunno, it might be that somewhere elsewhere in your templates, you might have missed a %> somewhere else in your template. I found this used to crash webbrick at times, so try checking there. Skim reading your coede it seems Ok but I haven't read in any detail
Bookmarks