Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

404 default.png image path in profiles table (database) #3795

Closed
diasp opened this issue Dec 10, 2012 · 8 comments
Closed

404 default.png image path in profiles table (database) #3795

diasp opened this issue Dec 10, 2012 · 8 comments

Comments

@diasp
Copy link
Contributor

diasp commented Dec 10, 2012

Before asset pipeline the image path was

https://diasp.eu/images/user/default.png

With the asset pipeline the path changed to

https://diasp.eu/assets/user/default.png

I think we need some script to solve the migration problem!?

Table: profiles
Columns: image_url, image_url_small, image_url_medium
Changes: from /images/ to /assets/

@jhass
Copy link
Member

jhass commented Dec 10, 2012

A simple

UPDATE profiles
SET image_url        = REPLACE(image_url,        'images', 'assets'),
    image_url_small  = REPLACE(image_url_small,  'images', 'assets'),
    image_url_medium = REPLACE(image_url_medium, 'images', 'assets')
WHERE image_url LIKE '%images/user/default.png';

baked into a migration should do. But requires testing! :P

@adnanayn
Copy link

I'm newcomer :-) @MrZyx is it done?? If not, Can you help me to fix this :-)

@jhass
Copy link
Member

jhass commented Dec 22, 2012

Sorry, won't be online too much over the holidays. But if you want to try it, don't let that stop you ;). So try to replicate the situation in your local database and then see if you can fix it :)

@Flaburgan
Copy link
Member

@YasirAdnan are you currently working on this ? You just have to test the SQL @MrZyx posted above, and look if you have the expected behavior.

@adnanayn
Copy link

adnanayn commented Jan 4, 2013

@Flaburgan Yes, I'm currently working on this. I will be happy if I can more help from you and @MrZyx. As, I'm a newcomer.:-)

@Flaburgan
Copy link
Member

Just ask, what do you need ? (Btw, I'm a newcomer too :) )

@embs
Copy link
Contributor

embs commented Apr 4, 2013

I've been seeking on how to solve this issue and finally got to the implementation of the image_url method:

  # profile.rb
  def image_url(size = :thumb_large)
    result = if size == :thumb_medium && self[:image_url_medium]
               self[:image_url_medium]
             elsif size == :thumb_small && self[:image_url_small]
               self[:image_url_small]
             else
               self[:image_url]
             end
    result || '/assets/user/default.png'
  end

Isn't the line for the method return enough to accomplish the solution? Could you guys clarify why this change on database is still necessary?

@jhass
Copy link
Member

jhass commented Apr 4, 2013

I can't pinpoint it but there was a time where we wrote the default profile picture into the database:

diaspora_production=# SELECT COUNT(*) FROM profiles WHERE image_url LIKE '%images/user/default.png';
 count 
-------
    54
(1 row)

Edit: Actually we still do that, maybe because we write the default picture into the HCard so it gets stored when fetching a remote profile.

@jhass jhass closed this as completed in 16cf699 Apr 4, 2013
jhass added a commit that referenced this issue Apr 4, 2013
…image-url

Fix default image url in profiles table. Closes #3795
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants