Image Not Displaying In Paperclip

This is what i’ve tried using paperclip

My Model.rb
validates_presence_of :book_name, :price, :description, :author

has_attached_file :avatar, :default_url =>
“/images/:style/missing.png”
validates_attachment_content_type :avatar, :content_type =>
[“image/jpg”, “image/jpeg”, “image/png”, “image/gif”]

i’m not using styles because it is giving error “Avatar
Paperclip::Errors::NotIdentifiedByImageMagickError”

In Index File
the tag i’m using.

<%= image_tag booki.avatar.url(:thumb)%>

On 7 April 2015 at 09:52, Edward M. [email protected] wrote:

i’m not using styles because it is giving error “Avatar
Paperclip::Errors::NotIdentifiedByImageMagickError”

In Index File
the tag i’m using.

<%= image_tag booki.avatar.url(:thumb)%>

You have not explained what is not happening that should happen. Do
you mean that the thumb does not display? Is the html correct (view
the html in the browser).

Colin

Colin L. wrote in post #1171572:

On 7 April 2015 at 09:52, Edward M. [email protected] wrote:

i’m not using styles because it is giving error “Avatar
Paperclip::Errors::NotIdentifiedByImageMagickError”

In Index File
the tag i’m using.

<%= image_tag booki.avatar.url(:thumb)%>

You have not explained what is not happening that should happen. Do
you mean that the thumb does not display? Is the html correct (view
the html in the browser).

Colin

Check Out My Post TITLE Again.

On 7 April 2015 at 11:07, Edward M. [email protected] wrote:

you mean that the thumb does not display? Is the html correct (view
the html in the browser).

Colin

Check Out My Post TITLE Again.

Check out my QUESTION again. ie Is the html correct?

It is always better to ask a specific question within the content of
the post. As I type this I cannot see the subject line on screen. I
have to scroll up to see it. Also the title says “image not
displaying in paperclip”. That is ambiguous. It could be that it is
displaying the wrong image, or no image at all. Or possibly a run time
error is displayed.

Finally, the best way to get help is not to SHOUT at those who are
spending their time trying to help.

Absolutely finally, don’t forget to answer my question - is the html
correct?

Colin

On 7 April 2015 at 11:53, Edward M. [email protected] wrote:

Finally, the best way to get help is not to SHOUT at those who are
then in place of image i’m getting image name like “example image”
I don’t understand what you mean by getting that message when you hit
submit. I thought the problem with displaying the image. What
exactly is the question you are asking? Do you think the upload is
failing? I presume you have looked in development.log to see if there
were any errors there.

Colin

Colin L. wrote in post #1171580:

On 7 April 2015 at 11:53, Edward M. [email protected] wrote:

Finally, the best way to get help is not to SHOUT at those who are
then in place of image i’m getting image name like “example image”
I don’t understand what you mean by getting that message when you hit
submit. I thought the problem with displaying the image. What
exactly is the question you are asking? Do you think the upload is
failing? I presume you have looked in development.log to see if there
were any errors there.

Colin

i have made a diff show.html.erb that after i hit submit will redirect
me to show file in which i am getting the name of image instead of
image. earlier i was getting error or imagemagick but after some google
search i found removing styles will do but now i am only getting the
name of image(and yea i have checked log file for errors NO ERROR) and i
have checked via console too the image is getting stored but not
displaying, image is getting stored in public images . .

Colin L. wrote in post #1171577:

Check out my QUESTION again. ie Is the html correct?

It is always better to ask a specific question within the content of
the post. As I type this I cannot see the subject line on screen. I
have to scroll up to see it. Also the title says “image not
displaying in paperclip”. That is ambiguous. It could be that it is
displaying the wrong image, or no image at all. Or possibly a run time
error is displayed.

Finally, the best way to get help is not to SHOUT at those who are
spending their time trying to help.

Absolutely finally, don’t forget to answer my question - is the html
correct?

Colin

Yes, and once you said only post those part of code which is incorrect
so there’s no point in asking about html as m sure about that validation
part is incorrect(i have done a lot of google search) when i hit submit
then in place of image i’m getting image name like “example image”

On 7 April 2015 at 12:41, Edward M. [email protected] wrote:

Colin

i have made a diff show.html.erb that after i hit submit will redirect
me to show file in which i am getting the name of image instead of
image. earlier i was getting error or imagemagick but after some google
search i found removing styles will do but now i am only getting the
name of image(and yea i have checked log file for errors NO ERROR) and i
have checked via console too the image is getting stored but not
displaying, image is getting stored in public images . .

So, if I understand correctly, you have some erb in the view that
should show an image, but in fact it just shows the name. In your
situation the first thing I would do is to look at the html to see
what html the image_tag is generating. For some reason you don’t seem
to want to do that.

Colin

On 7 April 2015 at 13:49, Edward M. [email protected] wrote:

<%=image_tag(book.image.url(:medium)) %>

tried this is on my frnds system and everything works fine on his system
so i’m sure there’s nothing wrong in my application but don’t know why
image is not coming up

I just cannot understand why you don’t want to look at the html. I
cannot see how you can move forward without that. It is trivially
easy to do.

Colin

Colin L. wrote in post #1171598:

On 7 April 2015 at 12:41, Edward M. [email protected] wrote:
So, if I understand correctly, you have some erb in the view that
should show an image, but in fact it just shows the name. In your
situation the first thing I would do is to look at the html to see
what html the image_tag is generating. For some reason you don’t seem
to want to do that.

Colin

<%=image_tag(book.image.url(:medium)) %>

tried this is on my frnds system and everything works fine on his system
so i’m sure there’s nothing wrong in my application but don’t know why
image is not coming up

Colin L. wrote in post #1171608:

On 7 April 2015 at 13:49, Edward M. [email protected] wrote:

<%=image_tag(book.image.url(:medium)) %>

tried this is on my frnds system and everything works fine on his system
so i’m sure there’s nothing wrong in my application but don’t know why
image is not coming up

I just cannot understand why you don’t want to look at the html. I
cannot see how you can move forward without that. It is trivially
easy to do.

Colin

I just don’t know now that how can i make you understand :frowning:
"tried this is on my frnds system and everything works fine on his
system

so i’m sure there’s nothing wrong in my application but don’t know why
image is not coming up"

Colin L. wrote in post #1171616:

On 7 April 2015 at 13:59, Edward M. [email protected] wrote:

easy to do.

Colin

I just don’t know now that how can i make you understand :frowning:

By showing us the html that the image tag generates. I am beginning
to think that you do not understand what I mean by that.

Colin

Do you have just 2 minutes to come over skype ?
silent_assassinoo7

On 7 April 2015 at 14:26, Edward M. [email protected] wrote:

Colin

Do you have just 2 minutes to come over skype ?
silent_assassinoo7

Don’t do skype.
Just explain why you cannot post the html.
Does it even display the page containing your image_tag, is that the
problem?
If so then post the section of development.log showing the submit and
response.

Colin

On 7 April 2015 at 13:59, Edward M. [email protected] wrote:

easy to do.

Colin

I just don’t know now that how can i make you understand :frowning:

By showing us the html that the image tag generates. I am beginning
to think that you do not understand what I mean by that.

Colin

ABC 123 CBA DBA
    <td><img src="/images/posts/8-captives-medium.jpg?1428471543"

alt=“8 captives medium” />

Show
Edit
Destroy

On 8 April 2015 at 06:41, Edward M. [email protected] wrote:

ABC 123 CBA DBA
    <td><img src="/images/posts/8-captives-medium.jpg?1428471543"

alt=“8 captives medium” />

So does that file exist?

Colin

On Tue, Apr 7, 2015 at 8:26 PM, Edward M. [email protected]
wrote:

Colin

Do you have just 2 minutes to come over skype ?
silent_assassinoo7’

it’s not hard to know generated html
you can do it by inspecting element
http://testingfreak.com/inspect-element-in-firefox-chrome-or-ie-browsers

generated html will be like this :


or


Mou Dareka no, tame janakutte
Jibun no Tame ni Warette Iru

( Aqua Timez - Alones )

On 8 April 2015 at 11:30, Edward M. [email protected] wrote:

alt=“8 captives medium” />

So does that file exist?

Colin

Yes and is also getting stored in images folder

Exactly which folder is the file 8-captives-medium.jpg stored in?
Full path please.

On the view page in the browser do you see “8 captives medium” where
the image should be?

Post the bit of development.log showing the request for the view page
please.

Please answer all three questions to save me asking again. Thanks.

Colin

Colin L. wrote in post #1171709:

On 8 April 2015 at 06:41, Edward M. [email protected] wrote:

ABC 123 CBA DBA
    <td><img src="/images/posts/8-captives-medium.jpg?1428471543"

alt=“8 captives medium” />

So does that file exist?

Colin

Yes and is also getting stored in images folder

See comments inserted below

On 9 April 2015 at 06:06, Edward M. [email protected] wrote:

Please answer all three questions to save me asking again. Thanks.

Colin
Answer 1:- app/public/images/posts/images.jpg

If you had inserted your comment immediately below my question it
would have saved you typing.
So when I asked “does that file exist” meaning 8-captives-medium.jpg
and you said yes, then actually meant you meant there is a file called
images.jpg but not one of the expected name.

Answer 2:- http:// prntscr.com /6rgtxn (Remove Spaces)

“Yes” would have done

app/models/book.rb:2:in <class:Book>' app/models/book.rb:1:in<top (required)>’
app/controllers/books_controller.rb:17:in `new’

So when you said “and yea i have checked log file for errors NO ERROR”
then that was not entirely correct.

Rendered

/home/amit/.rvm/gems/ruby-2.2.0/gems/actionpack-4.2.1/lib/action_dispatch/middleware/templates/rescues/_source.erb

And that shows the html that you posted containing the image tag?
Unlikely I think.

No time at the moment, will look again later.

Colin

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