banner
阿珏酱

阿珏酱

いつもとは逆の電車に乗り、見たこともない風景を見に行く
twitter
github
facebook
bilibili
zhihu
steam_profiles
youtube

Random 2D Image API Volume 3

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

image
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.
This time, I mainly updated a tutorial image and added 3000+ random 2D API images, along with some optimizations to the interface, and that's about it.

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

Extras

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.
Some may say that my writing has efficiency issues, but I say, when your images haven't reached hundreds of thousands and the file doesn't exceed tens of megabytes, there's no need to consider efficiency.
There are many methods, and the one that suits you is the best.

Additionally, the first interface has actually been indefinitely suspended due to overload.
Because an update triggered by a single image is really quite random. (Forced update)
image

Updates

  • March 23, 2020
    1. Updated the type parameter, values: pc, mobile
    2. Added 1000 mobile images
    3. Added 1000 pc images

User Comments:

image 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

image Self-taught College 7 months ago (2020-10-15)
Daily urging for updates, the blogger's updates have been a bit long, crying

image Ajuo 7 months ago (2020-10-16)
@Self-taught College: It's updated now.

image Shenzhen Self-taught Associate Degree 7 months ago (2020-10-12)
This blog is still here!! Blogger, don't give up!

image Haha 9 months ago (2020-08-10)
[#This comment is private]

image Karuboniru 1 year ago (2020-03-31)
It seems that the random image relies on cookies, but the API does not set the cookie with SameSite=None and secure attributes, causing some browsers to refuse to accept this cookie, resulting in users only facing the same image.

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.

image Karuboniru 1 year ago (2020-04-03)
@Ajuo: OK, it's better now.

image Ajuo 1 year ago (2020-04-04)
@Karuboniru: This is also thanks to you.

image 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.

image 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.

image Ajuo 1 year ago (2020-04-06)
@Karuboniru: Now it really works, I even downloaded FireFox to test it.

image 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.

image Trash Sponge 1 year ago (2020-03-18)
Give me something strong.

image Ajuo 1 year ago (2020-03-18)
@Trash Sponge: As long as you can refresh it.

image Trash Sponge 1 year ago (2020-03-18)
@Ajuo: Thanks, I'm good now, how about you?

image Onisan 1 year ago (2020-03-16)
I really like this image library feature.

image 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).

image 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.

image Aoyama 1 year ago (2020-03-11)
I want something without clothes.

image Ajuo 1 year ago (2020-03-12)
@Aoyama: This won't do, this thing has to be watched secretly by one person.

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.