mirror of
https://github.com/wgh136/nysoure.git
synced 2025-09-27 04:17:23 +00:00
Improve image api.
This commit is contained in:
@@ -85,7 +85,7 @@ function ActivityCard({ activity }: { activity: Activity }) {
|
||||
<div>
|
||||
<img
|
||||
className={"object-contain max-h-52 mt-2 rounded-lg"}
|
||||
src={network.getImageUrl(activity.resource.image.id)}
|
||||
src={network.getResampledImageUrl(activity.resource.image.id)}
|
||||
alt={activity.resource.title}
|
||||
/>
|
||||
</div>
|
||||
|
@@ -110,7 +110,11 @@ func CreateImage(uid uint, ip string, data []byte) (uint, error) {
|
||||
|
||||
// If the image is still too large after conversion, return an error
|
||||
if len(data) > 1024*1024*4 {
|
||||
return 0, model.NewRequestError("Image data is too large after conversion")
|
||||
return 0, model.NewRequestError("Image data is too large")
|
||||
}
|
||||
// Normal user has a smaller upload limit
|
||||
if !canUpload && len(data) > 1024*1024*2 {
|
||||
return 0, model.NewRequestError("Image data is too large")
|
||||
}
|
||||
|
||||
filename := uuid.New().String()
|
||||
|
Reference in New Issue
Block a user