Tips: When you see this prompt, it means that the current article has been migrated from the original emlog blog system, and the publication date of the article is quite old. The arrangement and content may not be complete, please understand.
Random 2D Image API Volume 3#
Date: 2020-3-10 Ajuo Code tinkering Views: 3717 Comments: 27
I had originally pinned the second volume, and didn't plan to release the third volume, but after thinking about it, I ended up coming up with so much to say. I thought, if I don't post it, wouldn't that be a waste of so many brain cells?
It has been 2 years since the last update, and the API has been running smoothly for over 2 years now.
All images are hosted on Sina Cloud servers, with global CDN acceleration. Thanks to Fantasy Domain for providing the upload service.
API Address: #
Parameters #
Parameter Name | Description |
size (optional) |
Value: 0~7, the level of the returned image thumbnail (size), the larger the number, the blurrier the image and the smaller the image size, default is 0. For example, https://random.52ecy.cn/randbg.php?size=4 |
type (optional) |
Value: pc, mobile, the type of the returned image, pc is for desktop wallpaper, mobile is for mobile wallpaper (portrait), default is pc. For example, https://random.52ecy.cn/randbg.php?type=mobile |
Many people have asked me whether the API is open source, but I think it's unnecessary, and it can't even be called open source. It's just a few lines of code, two commands, and I would feel embarrassed to share it.
There are many methods, and the one that suits you is the best.
Because an update triggered by a single image is really quite random.
Updates
- March 23, 2020
- Updated the type parameter, values: pc, mobile
- Added 1000 mobile images
- Added 1000 pc images
User Comments:
Rainshaw 6 months ago (2020-11-21)
The 127.0.0.1 domain seems to have been blacklisted by the system. The development environment has become harsh (x
Self-taught College 7 months ago (2020-10-15)
Daily urging for updates, the blogger's updates have been a bit long, cryingAjuo 7 months ago (2020-10-16)
@Self-taught College: It's updated now.
Shenzhen Self-taught Associate Degree 7 months ago (2020-10-12)
This blog is still here!! Blogger, don't give up!
Haha 9 months ago (2020-08-10)
[#This comment is private]
Karuboniru 1 year ago (2020-03-31)
It seems that the random image relies on cookies, but the API does not set the cookie withSameSite=None
andsecure
attributes, causing some browsers to refuse to accept this cookie, resulting in users only facing the same image.Ajuo 1 year ago (2020-04-03)
@Karuboniru: If you hadn't told me, I wouldn't have noticed this issue. I didn't expect that even in 2022, there would still be such a problem. It has been fixed now.Karuboniru 1 year ago (2020-04-03)
@Ajuo: OK, it's better now.Ajuo 1 year ago (2020-04-04)
@Karuboniru: This is also thanks to you.
Karuboniru 1 year ago (2020-04-05)
@Karuboniru: Or consider changing the random seed to be generated by site + time, which might avoid using cookies.Karuboniru 1 year ago (2020-04-04)
@Ajuo: Hmm, Chrome is fine now, but FireFox Nightly still doesn't send this cookie. I looked at the response, and the PHPSESSID cookie still doesn't have the samesite and secure attributes set.Ajuo 1 year ago (2020-04-06)
@Karuboniru: Now it really works, I even downloaded FireFox to test it.
Karuboniru 1 year ago (2020-04-20)
@Ajuo: The cookie's validity period is the session.
Visitors still have a high probability of seeing the same image.
I think it can be changed to persistent.
Trash Sponge 1 year ago (2020-03-18)
Give me something strong.
Ajuo 1 year ago (2020-03-18)
@Trash Sponge: As long as you can refresh it.
Trash Sponge 1 year ago (2020-03-18)
@Ajuo: Thanks, I'm good now, how about you?
Onisan 1 year ago (2020-03-16)
I really like this image library feature.
Lin and Lurking 1 year ago (2020-03-11)
I tested it today, whether embedded in a webpage, directly fetched with wget, or adding random characters and numbers after the parameters, I always get the same image (https://tva1.sinaimg.cn/large/0072Vf1pgy1fp20dsdtuoj318g0vf10y).Ajuo 1 year ago (2020-03-12)
@Lin and Lurking: I don't know how you called it, but calling it according to the tutorial in the image above works fine.
Aoyama 1 year ago (2020-03-11)
I want something without clothes.Ajuo 1 year ago (2020-03-12)
@Aoyama: This won't do, this thing has to be watched secretly by one person.