• Home
  • New Entries
  • Popular Entries
  • Submit a Story
  • About

How to refresh Image through ajax request ...

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 hereCode in rhtml file

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

Type

<%= submit_tag Create Image %>


Image:

code in controllerdef index@Rows =20@Cols = 120@alpha = params[:alpha].to_i@margin = params[:margin].to_iif params[:height].to_i >9000 || params[:width].to_i > 9000if params[:height].to_i >9000params[:height] = 8999endif params[:width].to_i > 9000params[:width] = 8999endendif params[:height] && params[:width]@Rows =params[:height].to_i@Cols = params[:width].to_iend@Start = params[:input_field_1]@End = params[:input_field_2]if params[:type] == gradationfill = 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 != 0img_new = img.rotate(90)if params[:reverse]img_rev = img_new.rotate(270)img_rev.write("public/images/xyz.jpg")render :text => ""elseimg_new.write("public/images/xyz.jpg")render :text => ""endend
end

      Answer1:On Jan 16, 2009, at 07:25 , Kumar Saurav wrote:> 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 herepls ask these q is in the rubyonrails forums/lists.
      Answer2:Ryan Davis wrote:
> On Jan 16, 2009, at 07:25 , Kumar Saurav wrote:
>
>> 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
>
> pls ask these q is in the rubyonrails forums/lists.I don have access of that forum due to lost of the password and i
think it belongs to this forum also so i put it here.
Thanks
      Answer3:Kumar Saurav wrote:
> Ryan Davis wrote:
>> On Jan 16, 2009, at 07:25 , Kumar Saurav wrote:
>>
>>> 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
>>
>> pls ask these q is in the rubyonrails forums/lists.
>
> I don have access of that forum due to lost of the password and i
> think it belongs to this forum also so i put it here.
> ThanksSorry i misunderstood.Thanks for the suggestion
      Answer4:On Jan 17, 2:33�am, Kumar Saurav wrote:
>
> > I don have access of that forum due to lost of the password and i
> > think it belongs to this forum also so i put it here.
> > Thanks
>
> Sorry i misunderstood.
>
> Thanks for the suggestion
> --
> Posted viahttp://www.ruby-forum.com/.Have you tried: periodically_call_remote?or (non-AJAX):
      Answer5:AGoofin wrote:
> On Jan 17, 2:33�am, Kumar Saurav wrote:
>>
>> > I don have access of that forum due to lost of the password and i
>> > think it belongs to this forum also so i put it here.
>> > Thanks
>>
>> Sorry i misunderstood.
>>
>> Thanks for the suggestion
>> --
>> Posted viahttp://www.ruby-forum.com/.
>
> Have you tried: periodically_call_remote?
>
> or (non-AJAX): Hi
As i sent you code i have to refresh the whole form not a single element
. So please let me know if you have any solution regarding to whole
form.Thanks in Advance.
      Answer6:Kumar Saurav wrote:
> I am using Ajax Request(Rmagick in controller)
> for changing image on my DIV but the problem is it refresh for first
> time only
[...]
> render :text => ""Perhaps the browser caches this image. The browser isn aware that it
has changed. I suggest you add some random string to the image is URL.
E.g. /image/xyz.jpg?56543653.
      Answer7:Albert Schlef wrote:
> Kumar Saurav wrote:
>> I am using Ajax Request(Rmagick in controller)
>> for changing image on my DIV but the problem is it refresh for first
>> time only
> [...]
>> render :text => ""
>
> Perhaps the browser caches this image. The browser isn aware that it
> has changed. I suggest you add some random string to the image is URL.
> E.g. /image/xyz.jpg?56543653.Hi i just hard code the path like "public/images/xyz.jpg?1234" but after
that i get the following errorno encode delegate for this image format `public/images/xyz.jpg?1234RAILS_ROOT: C:/Myworkspace/css_menu_builder - import
Application Trace | Framework Trace | Full Traceapp/controllers/image_builders_controller.rb:68:in `write
app/controllers/image_builders_controller.rb:68:in `indexSo please help me how can i add any random string after the URL
Please let me help ...
Thanks in advance
      Answer8:On Jan 19, 2009, at 02:30 , Kumar Saurav wrote:> So please help me how can i add any random string after the URL
> Please let me help ...this DOES NOT belong on this list.
      Answer9:Kumar Saurav wrote:
> Albert Schlef wrote:
>> Kumar Saurav wrote:
>> [...]
>>> render :text => ""
>>
>> Perhaps the browser caches this image. The browser isn aware that it
>> has changed. I suggest you add some random string to the image is URL.
>> E.g. /image/xyz.jpg?56543653.
>
> Hi i just hard code the path like "public/images/xyz.jpg?1234" but after
> that i get the following error
>
> no encode delegate for this image format `public/images/xyz.jpg?1234You added that random string in img_rev.write(). No good. Add it to the
URL. In other words, add it in the tag. You need to send the
browser instead of just
src="pic.jpg">.
      Answer10:Ryan Davis wrote:
> On Jan 19, 2009, at 02:30 , Kumar Saurav wrote:
>
>> So please help me how can i add any random string after the URL
>> Please let me help ...
>
> this DOES NOT belong on this list.I am not sure it doesn belong here. It is an HTML/HTTP issue, not a
Rails one. It doesn involve the Rails API, AFAICS. But I will submit to
your judgment and forward Kumar to that other list in my next reply.
      Answer11:Albert Schlef wrote:
> Kumar Saurav wrote:
>> Albert Schlef wrote:
>>> Kumar Saurav wrote:
>>> [...]
>>>> render :text => ""
>>>
>>> Perhaps the browser caches this image. The browser isn aware that it
>>> has changed. I suggest you add some random string to the image is URL.
>>> E.g. /image/xyz.jpg?56543653.
>>
>> Hi i just hard code the path like "public/images/xyz.jpg?1234" but after
>> that i get the following error
>>
>> no encode delegate for this image format `public/images/xyz.jpg?1234
>
> You added that random string in img_rev.write(). No good. Add it to the
> URL. In other words, add it in the tag. You need to send the
> browser instead of just
> src="pic.jpg">.Hi i solved out that problem through your suggestion
Thanks. Thanks a lotAnd Hi Ryan
I am ensuring you that i will try to post in the right listThanks for your support also.
      Answer12:Albert Schlef wrote:> Perhaps the browser caches this image. The browser isn aware that it
> has changed. I suggest you add some random string to the image is URL.
> E.g. /image/xyz.jpg?56543653.Why not use image_path()? Then the number is not random, but a time

 Original Source:

AddThis Social Bookmark Button

Posted at 09:43:25 am | Permalink | Posted in Ruby  Ajax  

Related Stuff

  • MooV: Using cutting edge Video phones and Software Video Phones - coupling all that with VoIP and empowering the disabled.

  • Moo Telecom: VoIP communications made easy - Ring anyway with the fun and ease of using a normal phone

  • TagR:Mobile Social Network with Real Time Locations Based services, and Ambience Intelligence, VoiP, IM, Skype, Googletalk, Mapping, Flickr, Events, Calendaring, Scheduling, SecondLife Support

  • ClearSMS : ClearSMS is a Web-based application that lets you send bulk SMS messages to your customers, contacts, or just about anyone.

  • Jajah:jah is a VoIP (Voice over IP) provider, founded by Austrians Roman Scharf and Daniel Mattes in 2005[1]. The Jajah headquarters are located in Mountain View, CA, USA, and Luxembourg. Jajah maintains a development centre in Israel.

  • Skype: It’s free to download and free to call other people on Skype. Skype the number one voice over ip software

  • PrivatePhone: a free local phone number with voicemail and messages you can check online or from any phone.

Top Stuff

e-messenger

MSN Web Messenger

eBuddy

ASP.NET Ajax CalendarExtender and Validation

AIM Express

Ajax Tools for ASP.NET Developers



About Ajaxlines

Ajaxlines is a project focused on providing its audience with a database of most of Ajax related articles, resources, tutorials and services from around the world.

Its purpose is to showcase the power of Ajax and to act as a portal to the Ajax development community.


Search


Topics

  • .Net (176)
  • Ajax (112)
  • Ajax Games (10)
  • Articles (95)
  • Bookmarking (35)
  • Calendar (21)
  • Chat (45)
  • ColdFusion (3)
  • CSS (84)
  • Email (23)
  • Facebook (84)
  • Flash (20)
  • Google (54)
  • Html (29)
  • Image (12)
  • International Calls & VOIP (7)
  • Java (58)
  • Javascript (280)
  • jQuery (200)
  • JSON (75)
  • Perl (2)
  • PHP (172)
  • Presentation (19)
  • Python (3)
  • Resources (2)
  • RSS (8)
  • Ruby (32)
  • Storage (4)
  • Toolkits (103)
  • Tutorials (227)
  • UI (11)
  • Utilities (174)
  • Web2.0 (18)
  • XmlHttpRequest (29)
  • YUI (13)

© 2006 www.ajaxlines.com. All Rights Reserved. Powered by IRange