Allow user to specify size of image via attributes

Originally reported over at TDWTF:

Don’t know how easy this one is to fix, and to be fair, I am rather misusing ninja edits by way of automation, but I figured it’s still worth reporting.

Steps to reproduce:

  1. Start writing a post and add an image to it
  2. Change the width/height attributes of the image (I make them smaller, and usually remove one of the attributes too)
  3. Submit the post
  4. Wait for the bot that automates some actions for you to ninja edit the post (for me, it’s usually within a few seconds)

Result: The image expands to the size the upload set it to.

Weirdly, if you ninja-edit manually, the issue doesn’t occur; it’s only when it’s done ‘behind the scenes’ the issue rears its head.


Not sure how well-known the term ninja edit is here; happy to explain if required :wink:

3 Likes

What does your bot do?

1 Like

Not a lot really; the feature that triggers the issue is something I wrote to substitute emoji like :slight_smile: for Discourse emoji like :smile:. It’s basically for when I’m posting from mobile, so I don’t have to remember all the Discourse codes (the auto-complete doesn’t show on mobile, not for me anyway).

1 Like

as @RaceProUK said, not much.

here’s the implementation with the relevant parts highlighted.

https://github.com/AccaliaDeElementia/SockBot/blob/master/sock_modules/emoji.js#L121-L135

Basically it follows /posts.json, looking for posts owned by the user the bot is operating on, that haven’t been touched by the bot before. then does a find/replace on a set of emoji, adds a hidden footer and fires off an edit post.

2 Likes

Why don’t you propose this as a feature? Seems like a good idea to me, and can be done server side.

6 Likes

Emojione have some mappings for unicode -> Emoji in thier js file, I proposed this before it is not a trivial change, that said would be really awesome on mobile

1 Like

The old title here was really confusing me cause we have this (which is planned):

I think this issue is about allowing users to cleanly specify width and height of an image and having it “take”. We may get to something like this if we had a “wizardy” thing in preview that allowed you to size images.

It wasn’t, but that does sound like a useful thing to have :smile: