How to refresh Image through ajax request

Hi all ,
I am very new for ruby. I am using Ajax Request(Rmagick in controller)
for changing image on my DIV but the problem is it refresh for first
time only then after i have to refresh the browser always. If anybody
having any solution, Please let me know . I am posting my code here

Code in rhtml file

<%= form_remote_tag({:url=>{:controller=>‘image_builders’, :action
=>‘index’}, :update =>‘photo’})%>


Type
<%= submit_tag 'Create Image' %>
Image:
      <div id="photo" style="width:99%;">

      </div>
      </div>

===============================================================================
code in controller

def index
@Rows =20
@Cols = 120
@alpha = params[:alpha].to_i
@margin = params[:margin].to_i
if params[:height].to_i >9000 || params[:width].to_i > 9000
if params[:height].to_i >9000
params[:height] = 8999
end
if params[:width].to_i > 9000
params[:width] = 8999
end
end
if params[:height] && params[:width]
@Rows =params[:height].to_i
@Cols = params[:width].to_i
end
@Start = params[:input_field_1]
@End = params[:input_field_2]
if params[:type] == ‘gradation’
fill = Magick::GradientFill.new(0, 0, 0, @Cols, @Start, @End)
img = Magick::Image.new(@Rows, @Cols, fill)
img.opacity = @alpha/ 127.0 * Magick::TransparentOpacity if
@alpha != 0
img_new = img.rotate(90)
if params[:reverse]
img_rev = img_new.rotate(270)
img_rev.write(“public/images/xyz.jpg”)
render :text => “
else
img_new.write(“public/images/xyz.jpg”)
render :text => “
end
end
end

On 17 Jan 2009, at 07:33, Kumar S. wrote:

Hi all ,
I am very new for ruby. I am using Ajax Request(Rmagick in controller)
for changing image on my DIV but the problem is it refresh for first
time only then after i have to refresh the browser always. If anybody
having any solution, Please let me know . I am posting my code here

Is it your browser caching the image?

Fred

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs