Hi @vinothkannans hoping its all going well, let us know if you are stuck on anything.
I tried to overlay broken chain icon on broken pictures. Now browser still returns mixed content warnings. We have to replace original image url with our broken chain image in post raw. So I have idea like below
Lorem Ipsum is simply dummy text of the printing and typesetting industry.
![](http://external-site1.com/some-broken-url.jpg)
Lorem Ipsum has been the industry's standard dummy text ever since the 1500s.
<img src="http://external-site2.com/very-large-image-url.jpg">
When an unknown printer took a galley of type and scrambled it to make a type specimen book.
Let assume above is original post raw. Then I think we can replace it like below
Lorem Ipsum is simply dummy text of the printing and typesetting industry.
![](https://meta.discourse.org/broken-image-placeholder.jpg)
Lorem Ipsum has been the industry's standard dummy text ever since the 1500s.
<img src="http://meta.discourse.org/general-placeholder.jpg">
When an unknown printer took a galley of type and scrambled it to make a type specimen book.
<!---
Broken images:
http://external-site1.com/some-broken-url.jpg
Large images:
http://external-site2.com/very-large-image-url.jpg
-->
Is it ok to add comments like this in post raw?
bump. just reminding @sam.
Yeah I had it bookmarked was about to reply
Letâs go through the workflow:
Someone adds an image, which somehow renders an image tag into the post, like this:
<img src='//assets-meta-cdck-prod-meta.s3.dualstack.us-west-1.amazonaws.com/original/3X/b/5/b52b10868d97bc52fa87e954705d2ff61acbb2d8.jpg' width="695" height="590" title="Gilded Flicker (Colaptes chrysoides)">
Our cooked post processor then download the image locally per earlier code.
If there are âproblemsâ it replaces the image with a magic âspanâ that we can style.
<span class='broken-image'></span>
or if image is too big
<a href='original image' class='large-image'><span></span><a>
Not following why you need any magic comments here. It can be broken in the post temporarily till the post processor runs.
Good idea.
Yes it will be broken until post processor. After post process broken image url will removed fully. So the user canât see it again to correct it. In that point of view I added comments. If it is not necessary we can skip it.
I donât see why end users need to know the url of the broken image, the author can always get to it by looking in the markdown. If we must get all fancy you could make a tooltip or something.
2 Beiträge wurden in ein neues Thema verschoben: System user replaces wrong URL when it downloads local copy of image
Why? From where is it removed fully?
Itâs still in raw, isnât it? I guess what @sam is saying is that the span for âtoo largeâ or âbroken imageâ should only be in cooked. At least thatâs how Iâm reading it.
No. It is markdown comment only. It wonât visible to end users. I thought broken urls going to be replaced in markdown itself (since we are doing like that for other urls). Now no problem since we are going to replace it only on cooked html
Yes this is only the case for cooked html and is only applied via post processor. No mucking with raw please.
Yes it going to be replaced only in cookied html. I was wrongly understood. Please bear with my understanding level in english
I think there is a use case for keeping an anchor tag of the broken image in the page. Say there is an image that can only be viewed by users who are authenticated on a certain website. When they post it on Discourse, it may throw an error and not display, but we still want to have <a href that links to the image, even if we donât embed it in the page.
May be in that case it is better if you link it instead of embedding the image directly.
Arenât images automatically embedded if you post the URL?
I pasted an image URL into this post without any other actions.
And it appears embedded. Now I post an invalid image URL
It appears as a link.
This is literally covered in the topic of the title, if the image is very large (imagine a 1 gigabyte image) it wonât be downloaded to your local instance.
Since we not changing the raw post I am unable to store which are the images broken or bigger size.
We are detecting broken & bigger images in pull_hotlinked_images
job. There we only editing raw post and triggering the cooked post_processor
job. Currently no way to send list of images should replace with placeholder to cooking process. Even if I try to cook in pull_hotlinked_images
job itself or try to send list of images to post_processor
job then again it will become problem when the post is recooked in future.
Can you please guide me to fix this problem?
I can live with a 5 minute delay here.
PullHotlinkedImages is guaranteed to run every time after cooked post processor. It queues it.
So just have PullHotlinkedImages edit the âcookedâ value direct on the post.
Great idea. Thank you
https://github.com/discourse/discourse/pull/5113
Travis failed for some other reason.
Now it is merged. Broken and large images will be replaced with placeholders.