Aliyun OSS, opens the image address and cannot be previewed. Download it directly.

Aliyun OSS, opens the image address can not be previewed, directly downloaded, has been bound to the oss domain name, and the record has been approved, is there any great god to point out! Thank you!

Oss
Apr.23,2021

Java SDK solves the following

String endpoint = "http://oss-cn-hangzhou.aliyuncs.com";
String accessKeyId = "<yourAccessKeyId>";
String accessKeySecret = "<yourAccessKeySecret>";

OSS ossClient = new OSSClientBuilder().build(endpoint, accessKeyId, accessKeySecret);

InputStream inputStream = new URL("https://www.aliyun.com/").openStream();
//  ContentType
ObjectMetadata objectMetadata = new ObjectMetadata();
objectMetadata.setContentType("image/jpg");
ossClient.putObject("<yourBucketName>", "<yourObjectName>", inputStream, objectMetadata);

ossClient.shutdown();

check Content-Disposition
and content-type


if you encounter the same problem, we are also trying to solve it. However, the common method is to add '.JPG', but we are three-terminal parallel, so we cannot add a suffix. We have not thought of a reasonable solution yet


when uploading (putObject), just input objectMetadata, to set the appropriate contentType. ObjectMetadata.setContentType ("image/jpg");

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b2bdc9-2bab0.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b2bdc9-2bab0.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?