Avatars not showing after import

I’m currently trying to import from IPB using a local dev environment on macOS without any virtualization.

I’m importing avatars via

upload = create_upload(user.id, img_path, File.basename(img_path))
if upload && upload.persisted?
    user.create_user_avatar
    user.user_avatar.update(custom_upload_id: upload.id)
    user.update(uploaded_avatar_id: upload.id)
else
    puts "Error: Upload did not persist #{img_path}!"
end

which creates the upload, creates the user_avatar and updates the uploaded_avatar_id for the user. However, the avatars are not showing after I import the user and after Sidekiq has processed all tasks.

The uploaded file also exists in the file system at
discourse/public/uploads/default/original/1X/a164bb6a13a258a27996f117c21d58ceb9ae8a52.png
and is referenced as
http://localhost:3000/user_avatar/localhost/florian/64/2_1.png
http://localhost:3000/user_avatar/localhost/florian/240/2_1.png

Any ideas on how to find more information on why the avatars are not showing?

Several imports later, I just wanted to give an update here: the version of the convert tool installed in my dev environment doesn’t support the bicubic interpolation method which is used in app/models/optimized_image.rb

I’ve found @marguerite’s post here, which helped me getting avatars to show up locally.

1 Like