Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a meme generator extension #8

Open
mojavelinux opened this issue Aug 5, 2014 · 15 comments
Open

Create a meme generator extension #8

mojavelinux opened this issue Aug 5, 2014 · 15 comments

Comments

@mojavelinux
Copy link
Member

53297362

Let's ruin the internet. R U with me?

@aalmiray
Copy link
Member

aalmiray commented Aug 5, 2014

checks date. Nope, it's not April 1st. So I guess this is really happening. 👍

Proposed syntax:

meme::<meme_id>[top="memes in asciidoc", bottom="o rly?", lang="en"]

The catch will be to properly identify the meme_id used by memegenerator, as we don't want to build a list of aliases, do we? (how can we keep up with new memes popping up?)

@jbaruch
Copy link

jbaruch commented Aug 5, 2014

I think url of image will be more flexible than meme_id. Can be usable outside of scope of memegenerator and won't have the watermark.

@aalmiray
Copy link
Member

aalmiray commented Aug 5, 2014

it depends on the meme generator service to be used by the meme macro. Notice the lang option? it may not be supported by others. Also memegenerator.net accepts uploading to img.ur and authenticated users. I guess it makes sense to come up with a list of options this extension must support.

@mojavelinux
Copy link
Member Author

😉

@aalmiray I think you definitely have the right idea. The meme_id could be an id or a URL, and the extension can be smart about what to do. We could also default to English if language isn't specified.

Remember, we can use positional attributes to make it shorter...and quotes are only required if there's a comma in the content.

meme::Y_U_NO[Write memes?]

If we get the meme_generator gem working again, it queries for a list of meme characters, so you can always pull it from the commandline. Actually, the list still works, the generator just fails.

@jbaruch
Copy link

jbaruch commented Aug 5, 2014

Wait a second, why you need a service at all? All you need is image as a bg to write on top of it in caps impact bold font. Can't we do it without a service?

@aalmiray
Copy link
Member

aalmiray commented Aug 5, 2014

@jbaruch: Ugh, no. I don't want to deal with an image manipulation library that requires a local gem to work.

@mojavelinux: a downside of using a service is recreating the same image with every build, unless some kind of caching/verification is put in place. Agreed on making English the default lang; I was just stating some of the options that may be used ;-)

@mojavelinux
Copy link
Member Author

Absolutely we can. mini_magick (works on Ruby and JRuby). In fact, I just implemented something similar for doing the covers for NFJS, the Magazine. See, real work enables play!

https://github.com/opendevise/editions/blob/master/lib/editions/cover_annotator.rb

@aalmiray
Copy link
Member

aalmiray commented Aug 5, 2014

@jbaruch: on the plus side you can use any image you'd like, not just those available in the memegenerator service. I guess a local generator also solves the problem of duplicate images being uploaded.

The other downside I see is grabbing the images in the first place. I guess we can't win them all :P

@mojavelinux
Copy link
Member Author

Good news. The caching stuff is already implemented as part of Asciidoctor Diagram. That's why I think we could actually build on Asciidoctor Diagram APIs to make this extension...at least handle all the outer parts of managing the image and cache.

See https://github.com/asciidoctor/asciidoctor-diagram/blob/master/lib/asciidoctor-diagram/util/diagram.rb#L96

@mojavelinux
Copy link
Member Author

I'd start with using the service, then add the local build as the code matures. hahaha, meme code maturing...isn't that an oxymoron? Or just a moron?

@aalmiray
Copy link
Member

aalmiray commented Aug 5, 2014

methinks we need a new meme for this case 😸

@pepijnve
Copy link
Member

It's a shame ruby doesn't have a graphics api in the std lib. If depending on Java is ok, this kind of code is pretty trivial to write with Graphics2d. The only downside is that you're going to have to provide a URL to the base image; beyond that the syntax can be the same as what was proposed above.

The memegenerator.net service doesn't seem to be very reliable. I was browsing it a bit and I get lots of timeout errors.

@mojavelinux
Copy link
Member Author

This is now implemented in Asciidoctor Diagram. Shall we close this issue?

See https://github.com/asciidoctor/asciidoctor-diagram#the-meme-extension

meme::yunoguy.jpg[Doc writers,Y U NO \\ AsciiDoc]

@pepijnve
Copy link
Member

pepijnve commented Apr 2, 2016

The diagram implementaties does the image processing locally though. I had a look at using existing generator services but I couldn't figure out how to make those work without either having to do a search query (and possibly using the wrong image) or specifying the base image via its numeric id. Both seemed rather impractical.

@mojavelinux
Copy link
Member Author

specifying the base image via its numeric id

That's how the YouTube and Vimeo support work, so it's certainly not a foreign concept in the ecosystem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants