pull down to refresh

Currently to show an image on SN you have to specify the correct markdown. It'd be nice to just display the image when provided an image link without requiring markdown.
e.g. when a stacker puts this image link in a comment or discussion post https://imgproxy.snort.social/h_yDski4D7T74dzC6fwcBqwBoMOw3og33BmkNewTMjA/rs:fit:586:586/dpr:2/aHR0cHM6Ly9tZWRpYS50ZW5vci5jb20vVzY0SVhKQmZGcFlBQUFBQy9maXJpbmctZ3VuLWplbm5pZmVyLWNvb2xpZGdlLmdpZg
I'll pay double the bounty if it's well implemented with minimal need for changes. I'll pay triple the bounty if you also make it work for link posts where the link is an image.
100,000 sats paid
k00b's bounties
Okey so I ended up working on both parts,
  • the regex check for urls containing an image suffix e.g. (.gif, .png)
and
  • regular urls as shown in the bounty description that requires an async request to check if the url is for an image.
Here's a 4 minute video demo:
any feedback from stackers here would be appreciated, and of course from the guys at SN HQ. thanks
reply
Sorry for the delay. I still haven't reviewed the code but that's my fault - not yours.
reply
Sent you another 50k sats as recommended by @ekzyis after his review.
reply
much appreciated 👍 i keep an eye on github so any changes needed just fire me an @ on there and I'll dee what i can do
reply
874 sats \ 1 reply \ @uco 17 Feb 2023
Just pledged sats to this post to help with the bounty.
This will be a great improvement to the UI for SN!
reply
thank you sir 🤠
reply
I'd like to work on this Bounty, but I don't want to do so if I'm duplicating someone else's work. How do I know if anyone has claimed this?
reply
This is valid concern. Bounties might need to have an additional status to avoid multiple people working on the same bounty. Might suggest:
  • Open: active bounty waiting for a user to claim
  • Claimed: user informs @k00b that he will complete bounty in X days. If not completed in timeframe then status reverts back to Open.
  • Paid
reply
I agree it's a problem, but that solution creates the problem giving anyone the right to prevent everyone else from working on a bounty without any cost to them or test of credibility.
A middle of the road approach might allow people to signal that they're working on a bounty in a special kind of comment and comment section, and anyone else who might work on the bounty can fully gauge the risk of also working on it.
reply
I like the transparency of seeing who else might be working on a bounty.
Just brainstorming:
Maybe a user pledges Sats to Claim the right to work on bounty. Highest bidder is awarded the status of Claimed. Once completed they receive bounty plus sats pledged.
If they don’t complete the bounty they lose sats and Claim goes to second highest bid.
Users would bid high on bounties they are confident that match skills and can complete.
reply
That probably ideal game theoretically. It's putting up a bond.
It does introduce new problems: complicated UX and makes having sats a prereq. I'm not sure SN's bounty economy is ready for that, but it's probably the terminal state of a healthy bounty economy.
reply
"Pledging sats" would mean you would need to already have money in order to earn money... (And it is difficult to find work for Bitcoin recently.)
For what it's worth, if I see that someone else has started to work on the bounty, I cancel my attempt.
reply
If someone else has implemented it and I've accepted it, this bounty on SN will show as paid.
If someone has implemented it, they'll likely have submitted a PR.
reply
ok, well I'll give it a go and hope nobody else is hacking away at it, otherwise my time will be wasted. still, will be a good to learn a bit about the SN codebase
reply
I didn't start working on this to give new contributors a chance :) (I have been contributing to the SN codebase for some time now and I also claimed the previous bounty.)
Looking at the comments and Github, I think no one else has picked this up so I think you have good chances to get the bounty.
I am also glad to see someone picking this up!
reply
Created a new Github issue for collating any feedback: https://github.com/stackernews/stacker.news/issues/239
reply
thanks for the comment, spent some time tidying up and ended up also implementing the async lookup for when regex won't work.
i'll do a write-up in the morning and share it to get some feedback. once I started digging into this feature I found lots of little edge cases and considered several ways of implementing it, so i'll be curious what you think of the code
reply
There will be more bounties and if someone beats you to it yet your work is solid, I'll give you a partial bounty for the effort.
reply
I've got the first slice of this feature coded up, just needs a bit of tidying.
I figured that it'd makes sense to break the work down into two parts:
  1. Done: synchronously regex check and format urls that have a recognisable image url format
  2. TBD: asynchronously check urls and format them as images if the mimetype returned is an image
i'll open up a pull request to get some initial feedback and if you'd prefer not to merge until both parts are completes, that's your prerogative
reply
What if, for some reason, you just want to display the url of an image?
reply
When would you want to do that?
reply
I'm not sure. If you want to let user decide if they want to load the image or not (dirty image, large file size...)
reply
When this goes live, consider the door open to the meme avalanche, it will not be stopped
reply
Nice sample photo choice
reply
Big Coolidge fan recently
reply
A regex could provide a simple solution:
var img_regex = /(https?:\/\/([a-z0-9\/\._-])+\.(?:jpe?g|gif|png))/gi; var post_content = post_content.replace(img_regex, '<img src="$1">');
But this doesn't check if it is a valid image. Also would need to apply ZoomableImage.
reply
Regex fails on the image I provided in the bounty. Extensions are hints and conventions but are often not present.
reply
This will make image posting easier. When I post an image after putting markdown, I use the preview feature to see if the image is reflecting. When this bounty is integrated, some steps will be eliminated whenever I make an image post.
reply
We'll still be able to use markdown right?
reply
Lol mark downs days are numbered, I got shouted at for using it on Nostr apparently its the devils magic
reply
dude I hope not, I love markdown.
I think it's very much going strong. It's really popular in stats/data science
reply
One day!
reply