mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 15:52:11 +08:00
FIX: Fix image optimization pipeline (#9257)
* FIX: Do not use original filename to extract the original filename Prefer extracting filename from the destination path, which is build using extracted image information. * UX: Show better error images
This commit is contained in:
parent
cff9d4726c
commit
49395ec577
|
@ -3734,6 +3734,7 @@ en:
|
||||||
file_missing: "Sorry, you must provide a file to upload."
|
file_missing: "Sorry, you must provide a file to upload."
|
||||||
empty: "Sorry, but the file you provided is empty."
|
empty: "Sorry, but the file you provided is empty."
|
||||||
png_to_jpg_conversion_failure_message: "An error happened when converting from PNG to JPG."
|
png_to_jpg_conversion_failure_message: "An error happened when converting from PNG to JPG."
|
||||||
|
optimize_failure_message: "An error occured while optimizing the uploaded image."
|
||||||
attachments:
|
attachments:
|
||||||
too_large: "Sorry, the file you are trying to upload is too big (maximum size is %{max_size_kb}KB)."
|
too_large: "Sorry, the file you are trying to upload is too big (maximum size is %{max_size_kb}KB)."
|
||||||
images:
|
images:
|
||||||
|
|
|
@ -252,7 +252,6 @@ class UploadCreator
|
||||||
from,
|
from,
|
||||||
to,
|
to,
|
||||||
"50%",
|
"50%",
|
||||||
filename: @filename,
|
|
||||||
allow_animation: allow_animation,
|
allow_animation: allow_animation,
|
||||||
raise_on_error: true
|
raise_on_error: true
|
||||||
)
|
)
|
||||||
|
@ -264,6 +263,8 @@ class UploadCreator
|
||||||
|
|
||||||
return if filesize >= original_size || pixels == 0 || !should_downsize?
|
return if filesize >= original_size || pixels == 0 || !should_downsize?
|
||||||
end
|
end
|
||||||
|
rescue
|
||||||
|
@upload.errors.add(:base, I18n.t("upload.optimize_failure_message"))
|
||||||
end
|
end
|
||||||
|
|
||||||
def is_still_too_big?
|
def is_still_too_big?
|
||||||
|
|
Loading…
Reference in New Issue
Block a user