Forum: Ruby on Rails issue in uploading images

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
1586cffb7dc11f0c02b084b03ccf8fcf?d=identicon&s=25 Surekha Matte (Guest)
on 2006-05-03 19:06
(Received via mailing list)
Iam new at rubyonrails. I implemented the image upload in my
application.
The image uploaded successfully but if iam trying to see those uploaded
images they look awful.

So plz help me out in this issue.

this is my rhtml file

<%= form_tag({ :action => "create" },  :multipart => true) %>

  <p>Image:
  <input type="file" name="picture" /></p>

  <p><%= submit_tag 'upload' %></p>
<%= end_form_tag %>
controller

def create
       File.open(RAILS_ROOT + "
/public/images/#{@params['picture'].original_filename}", "w") { |f|
        f.write(@params["picture"].read) }
    redirect_to :controller => 'admin', :action => "new1",
    :bildpfad=> @request.protocol + @request.host_with_port + "
/images/#{@params['picture'].original_filename}"
 end
Ad91bce9c9a8c68b6942607e4721f74e?d=identicon&s=25 Beate Paland (Guest)
on 2006-05-03 19:06
(Received via mailing list)
Hi,

as the code you mentioned is from me, I should help you ;)
First, you don't neet the "bildpfad"-string, it was just for me to
insert in a new article.

second, could you specify "hey look awful"? What did you try? gif,
jpg, png? All awful?
What system are you using?

Beate
1586cffb7dc11f0c02b084b03ccf8fcf?d=identicon&s=25 Surekha Matte (Guest)
on 2006-05-03 19:06
(Received via mailing list)
Thanku so much for ur kind reply

I tried for gif,jpeg and png also. For gif and jpeg the image not
uploaded
properly I mean to say not as original image. In the case of png the
image
displayed as icon(symbol only) not as image.

Here Iam attaching the original image and uploaded images.

I removed "bildpfad"

Thanku so much
This topic is locked and can not be replied to.