Image URLs not rendered as images on import

AI-generated summary

In a discussion regarding Image URLs not rendered as images on import, user pfaffman reports that images imported via a custom script appear as raw URLs rather than rendered images. While editing posts or adding spaces temporarily fixes the display, running rake rebake fails to resolve the issue permanently. pfaffman also inquires if Discourse automatically pulls these images to its local store.

User DeanMarkTaylor explains that importing a high volume of posts creates a significant backlog of Sidekiq tasks, including image processing. A rebake operation likely adds more tasks to this queue rather than processing them immediately. They suggest increasing the number of Sidekiq workers to speed up processing. pfaffman notes that Sidekiq is not running on their development box and asks if restoring to a fresh install would fix the issue. DeanMarkTaylor points to a related Meta discussion for specific Sidekiq commands but defers questions about “magical fixes” to others.

I’ve written an importer for a custom database of external images. It’s based on import_scripts/vanilla_mysql.rb (and base.rb) (pulled just today). It’s creating posts that look good right to me (a few problems with categories yet to work out). Posts have lines like

http://example.com/veryFineImage.jpb

in them.

  • When I look at them the URL isn’t displaying the image.
  • If I edit the image, it shows the image in the preview window.
  • If I edit and add a space anywhere in the post the image is displayed as expected.

“No problem!” thinks me "just rebake the posts. I do a

bundle exec rake rebake

on my development box. It rebakes the posts Or so it claims!!!

But, no joy. The image urls still just show up as urls.

On a related note, once I figure this out, will Discourse pull those images to it’s local store like it normally does? Do I need to do anything to force it to do it to all of them? I don’t see any obvious thing to poke in sidekiq.

When a high number of posts are imported usually a significant backlog of tasks are created…
… which include processing remote image URL’s etc.

You can view the number of remaining tasks at your /sidekiq page.

A rebake is likely just adding to this queue.

To process the queue more quickly look into increasing the number of workers during the import period.

Thanks, @DeanMarkTaylor. So I made the right decision by deciding to stop working on it!

But this is a development box and sidekiq isn’t running. If I back up and upload to a fresh install, will it magically fix itself?

Refer to the discussion here:

Which includes commands to run for sidekiq etc.

Someone else might have to answer questions about magical fixes.