Pages:
Author

Topic: [Script] Imgur to TalkImg - automatically fix your broken images (Read 1862 times)

legendary
Activity: 2730
Merit: 7065
Farewell, Leo. You will be missed!
OK, it worked to some degree. The images that are still available and uploaded on vgy.me are now available with a TalkImg link. But it seems that for some reason vgy.me deleted most of the images I uploaded years ago. Those are unfortunately lost now. But that's not something that you can do anything about.

Excellent service, thanks a lot!
legendary
Activity: 2758
Merit: 6830
I was wondering if there is a quick way to add new image hosts to the code? A few years ago, I used vgy.me for images in some of my threads. Perhaps the script could be used to automatically replace those links as well.  
Yes, there is.

joker_josue is correct. The following line is used to grab the images which are then uploaded to talkimg:

Code:
const imageLinkRegex = /https:\/\/i\.imgur\.com\/.*?\.(png|jpg|jpeg|gif)/gi

For vgy.me, you would probably use:

Code:
const imageLinkRegex = /https:\/\/vgy\.me\/.*?\.(png|jpg|jpeg|gif)/gi

Or for both imgur and vgy.me:

Code:
const imageLinkRegex = /https:\/\/vgy\.me\/.*?\.(png|jpg|jpeg|gif)|https:\/\/i\.imgur\.com\/.*?\.(png|jpg|jpeg|gif)/gi
legendary
Activity: 1638
Merit: 4508
**In BTC since 2013**
Let's wait for TryNinja just in case. I guess the API key needs to be updated as well. If you use imgbb, you need to edit the API key in the code and enter your own. The API code is already set by default for your site, TalkImg, but it can also be edited. vgy.me surely has unique API codes as well. 

The API code is just for the script to upload to TalkImg.
The script does not use other API codes, it just takes the image link and sends it to TalkImg via API.


Note this explanation:
Imagine that I have images on Imgbb and I want to transfer them to TalkImg, is it possible?
Forgot to reply this one, sorry.

Yes, you can. I've added a imageLinkRegex variable at the top. It currently only matches imgur links ending with png, jpg, jpeg (edit: and gif).

If you want to match ONLY imgbb images, you can use:

Code:
/https:\/\/i\.ibb\.co\/.*?\.(png|jpg|jpeg|gif)/gi

If you want to match BOTH imgbb and imgur images:

Code:
/https:\/\/i\.ibb\.co\/.*?\.(png|jpg|jpeg|gif)|https:\/\/i\.imgur\.com\/.*?\.(png|jpg|jpeg|gif)/gi
legendary
Activity: 2730
Merit: 7065
Farewell, Leo. You will be missed!
As far as I know, just change the host address and the result will be the same. Try adjusting this line:
Code:
const imageLinkRegex = /https:\/\/i\.imgur\.com\/.*?\.(png|jpg|jpeg|gif)/gi

I don't know if it works on this host, but I know it worked on others. Try it.
Let's wait for TryNinja just in case. I guess the API key needs to be updated as well. If you use imgbb, you need to edit the API key in the code and enter your own. The API code is already set by default for your site, TalkImg, but it can also be edited. vgy.me surely has unique API codes as well. 
legendary
Activity: 1638
Merit: 4508
**In BTC since 2013**
Hi TryNinja,
I tried the script today and it works really well. After a quick check, it seems to have replaced all my old Imgur images with new TalkImg links.
I was wondering if there is a quick way to add new image hosts to the code? A few years ago, I used vgy.me for images in some of my threads. Perhaps the script could be used to automatically replace those links as well.  

As far as I know, just change the host address and the result will be the same. Try adjusting this line:
Code:
const imageLinkRegex = /https:\/\/i\.imgur\.com\/.*?\.(png|jpg|jpeg|gif)/gi

I don't know if it works on this host, but I know it worked on others. Try it.
legendary
Activity: 2730
Merit: 7065
Farewell, Leo. You will be missed!
Hi TryNinja,
I tried the script today and it works really well. After a quick check, it seems to have replaced all my old Imgur images with new TalkImg links.
I was wondering if there is a quick way to add new image hosts to the code? A few years ago, I used vgy.me for images in some of my threads. Perhaps the script could be used to automatically replace those links as well. 
legendary
Activity: 1638
Merit: 4508
**In BTC since 2013**
@TryNinja
Can I use your proxy for an add-on I'm developing for the project?

I still haven't managed to overcome that JSON issue...
Of course! Go for it.

Thanks! I didn't want to abuse it.

Soon we will have something new, which I believe will be something that everyone will like.
legendary
Activity: 2758
Merit: 6830
@TryNinja
Can I use your proxy for an add-on I'm developing for the project?

I still haven't managed to overcome that JSON issue...
Of course! Go for it.
legendary
Activity: 1638
Merit: 4508
**In BTC since 2013**
@TryNinja
Can I use your proxy for an add-on I'm developing for the project?

I still haven't managed to overcome that JSON issue...
legendary
Activity: 3038
Merit: 1330
Slava Ukraini!
Tried to run script, everything worked fine for about 30 minutes, got API rate limits message few times and then script got stuck at 87%:

Weird... I don't have any limits imposed on uploading.  Undecided
If you experience this type of situation again, let us know.
Today I tried to run script again to replace remaining images and now everything worked fine, remaining images were replaced just in few minutes. Have no idea why scripto stopped yesterday.
@TryNinja, thanks for this script, without it I wouldn't bother to replace my images manually.
legendary
Activity: 1638
Merit: 4508
**In BTC since 2013**
Tried to run script, everything worked fine for about 30 minutes, got API rate limits message few times and then script got stuck at 87%:

Weird... I don't have any limits imposed on uploading.  Undecided
If you experience this type of situation again, let us know.
legendary
Activity: 1652
Merit: 2177
Crypto Swap Exchange
Is it possible that this script would work for tradingview images as well if I changed imgur to tradingview? I noticed a lot of these disappeared out of older topics around the same time as the imgur situation, whereas the images themselves are still available via TV. I assume it'd be imageLinkRegex and decodeProxyImages lines of code that needs changing if so?

The strange thing is TV images are still working on the forum, but it seems that images prior the changes have been affected nonetheless, so ideally it'd also only change the broken ones.
legendary
Activity: 3038
Merit: 1330
Slava Ukraini!
Tried to run script, everything worked fine for about 30 minutes, got API rate limits message few times and then script got stuck at 87%:

Will try to run script again tomorrow, though most of remaining images isn't relevant anymore
legendary
Activity: 1652
Merit: 2177
Crypto Swap Exchange
Just used this script (better late than never I figured) and can also say it worked very well. Quite a lot of API rate limiting pauses but I guess this is to be expected using the key provided, or in general maybe. Ideally there would have been an option to ignore all images I've posted to Wall Observer, as that would have saved most of the work, but the script got the job done in the end regardless.

There were also some instances of images being uploaded, but then due to locked topic no post was edited, I assume this is where you are the OP you locked the topic maybe? I didn't generally find this happened with images in locked topics overall, just a few instances. Even when re-running the script it would still re-upload the images but be unable to edit the post... maybe this has already been discussed though.

legendary
Activity: 3556
Merit: 4191
Just spent the last 2 and a half hours running the script. 506 pages later and my images appear to have reappeared lol. Great job @TryNinja everything worked great.

Also want to say thank you to joker_josue for talkimg as that's the image site I used.
legendary
Activity: 1638
Merit: 4508
**In BTC since 2013**
Is that a 138meg .gif   Cheesy     As awesome as I think memes are, I think we can leave behind file formats from 1987 (36 years old in 9 days) that have been superseded.  Definitely deserves a cap, Imgur I had thought did this a while back but not retrospectively perhaps; probably its showing up as an disproportionate load to bear.
The fact that it's 36 years old and still in use, means it's a good thing to keep. I recently tested it, and for the right images it still produces smaller files than .png. So let's keep .gif Smiley

And don't forget that GIF is a framed image file, which is used to create moving images. So it turns out to be a different file type than a PNG or JPEG.

Now, speaking of history...  Roll Eyes
JPEG was created in 1992
And PNG was created in 1996

Another curiosity is that the PNG was created because of copyright issues with the GIF. The GIF files had used the LZW compression technique which was patented by another company. This has led to many companies having to pay to use GIF files. Only private individuals or non-profit institutions could use the GIF without paying.

That happened in 1994. At the time, GIF was the most used type of image on the internet, it took up less space than JPG and had adequate quality for the time. All this patent problem, motivated several developers to work on a new image format, which was able to compress images more and with better quality, the PNG. The next step was for browsers to accept this new format, which thanks to Microsoft and Netscape, with their browsers, made PNG become popular on websites.

At that time, two interesting online movements emerged:
"Burn All GIFs" - What motivated people to stop using the GIF and how to send thousands of emails to the company that had the patent.
"PNG's not GIF" - Which motivated people to use PNG instead of using GIF.

In 2004 the patent ceased to be valid and everyone can freely use GIFs.
Perhaps this was one of the first moves against patent lobbying done online.

legendary
Activity: 3290
Merit: 16489
Thick-Skinned Gang Leader and Golden Feather 2021
Is that a 138meg .gif   Cheesy     As awesome as I think memes are, I think we can leave behind file formats from 1987 (36 years old in 9 days) that have been superseded.  Definitely deserves a cap, Imgur I had thought did this a while back but not retrospectively perhaps; probably its showing up as an disproportionate load to bear.
The fact that it's 36 years old and still in use, means it's a good thing to keep. I recently tested it, and for the right images it still produces smaller files than .png. So let's keep .gif Smiley
STT
legendary
Activity: 3878
Merit: 1411
Leading Crypto Sports Betting & Casino Platform
Is that a 138meg .gif   Cheesy     As awesome as I think memes are, I think we can leave behind file formats from 1987 (36 years old in 9 days) that have been superseded.  Definitely deserves a cap, Imgur I had thought did this a while back but not retrospectively perhaps; probably its showing up as an disproportionate load to bear.
legendary
Activity: 2758
Merit: 6830
Imgur images are broken again! Feel free to use the script if you haven't already.
legendary
Activity: 1638
Merit: 4508
**In BTC since 2013**
You decide: here's the 10,000 largest images. Check a few of them, and see if they're worth saving. Judging by the file size, I already see a few duplicates.

If you allow images >2.5MB, you shouldn't provide [img]-tags for them, and add a warning that it can only be linked.

Yeah... I think it's better to guarantee the limit, for a better forum experience.
Larger images are linked by the forum as external links/files, so each one manages this as they see fit.

Perhaps if in the future I manage to add some warning element in this regard, I will try to do so.
Pages:
Jump to: