ImgFlip: Adding a meme easily

I have confirmed that imgflip is returning the image URL as HTTP instead of HTTPS. It seems changing the URL from HTTP to HTTPS in the composer window will get it to load. Ideally imgflip will just return the HTTPS url, I’ll reach out and see if they will make the change.

3 Likes

I created a branch that forces the return image URL to use HTTPS, I’d rather imgflip resolve this themselves, but if they do not, then you can just point to this branch in your app.yml using

git clone -b force-https https://github.com/cpradio/discourse-plugin-imgflip.git

4 Likes

Great service, @cpradio!

So what has changed recently, ImgFlip somehow returning a http:// instead of a https:// or has Chrome become more sensitive?

EDIT: ‘fix’ implemented and working! Cheers.

Potentially both. I do believe Chrome is much more sensitive, however, I don’t recall if imgflip initially returned HTTPS image urls or if it always returned HTTP. Sadly, all of my sandbox tests downloaded the files locally, so I can’t easily tell at the moment.

1 Like

Okay, doing more research I found information indicating it has always been this way with ImgFlip. I’m going to merge the branch into the master branch. @bletch, this means you can remove the -b force-https from your app.yml sometime later today/tomorrow, which will require a rebuild.

Even if ImgFlip does fix this on their end, it shouldn’t impact the plugin negatively.

5 Likes

Hey good news! I heard back from them today, they made the change on their end and now return the payload as HTTPS. I’ve confirmed the plugin continues to work as expected.

New payload response

{"success":true,"data":{"url":"https:\/\/i.imgflip.com\/2rf5zo.jpg","page_url":"https:\/\/imgflip.com\/i\/2rf5zo"}}
7 Likes

CORS policy failure error

I think there is another problem here, @cpradio .

I was previously running your force-http branch and whilst chasing down another but on the forum I thought I move to the master branch. This is misleading, I’ve reverted to the force-https branch and the issue is still there.

Our users are now reporting that they can’t insert memes. Looking at the browser console I see this error.

Access to XMLHttpRequest at 'https://api.imgflip.com/caption_image?username=imgflip_hubot&password=imgflip_hubot&template_id=87743020&text0=Work?&text1=Fail?' from origin 'https://sandbox.cpradio.org' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

Steps to reproduce

I am able to reproduce this on your sandbox at …

https://sandbox.cpradio.org/t/imgflip-plugin-example/54

…where I simply tried to insert a meme and got the error above. Screen shot of the actual console error…

Environment

I’m running the very latest tests-passed version of Discourse v2.3.0.beta2 +129.

I’m using Chrome Version 72.0.3626.96 (Official Build) (64-bit) on Linux - but I’ve also tested on Firefox and the same the problem occurs.

Please let me know if you need any more information.

I don’t think that is it, the error is the fact imgFlip changed how you authenticate, you now must signup for an account and use your account credentials. Try that.

Previously they just had a dummy account that was available for everyone to use.
https://api.imgflip.com/

1 Like

I just confirmed, that is what happened. Creating an account and using those credentials in the Admin > Settings made it work again on my sandbox.

2 Likes

That was it, @cpradio.

I registered for API access, entered the user and password in the settings and it’s working now.

Thanks again!

1 Like

I can edit is thai language

I’m not sure if I understand your question, but you would want to create a file using the Thai abbreviation (that Discourse uses) and submit it as a PR.

client.en.yml and server.en.yml are the two that need to be created.

2 Likes

I mean Sad => เศร้า

Oh, first off, that is ReplyGif, not ImgFlip. Second, that is from their endpoint and to my knowledge they do not have a way to request the categories in a particular language…
http://replygif.net/about

2 Likes

Sadly, their registering process seems to be broken :frowning:

I’ve contacted customer support to no avail.

Anyone nice enough to share their API credentials?

I’d really like to have that feature!

This is very likely against their TOS.

3 Likes

I contacted their support to no avail. I don’t think they’d mind me using what their service is supposed to provide.

In any case, I would agree to pay someone who has an api key if I incur any cost on the platform.

I frankly don’t care about their tos, I just want silly memes. :slight_smile:

1 Like

Have you tried using their regular signup form instead of the Google login?

The error prompts when I click on the login button. I can’t choose between standard or Google login.

Does it works on your end?

https://api.imgflip.com/

Yes, I’m able to login. I meant, did you use the sign-up form to create an account versus just trying to login via Google.