diff --git a/backend/src/uxbox/images.clj b/backend/src/uxbox/images.clj index 6f7127a18..5fe299de1 100644 --- a/backend/src/uxbox/images.clj +++ b/backend/src/uxbox/images.clj @@ -2,7 +2,10 @@ ;; License, v. 2.0. If a copy of the MPL was not distributed with this ;; file, You can obtain one at http://mozilla.org/MPL/2.0/. ;; -;; Copyright (c) 2016-2017 Andrey Antukh +;; This Source Code Form is "Incompatible With Secondary Licenses", as +;; defined by the Mozilla Public License, v. 2.0. +;; +;; Copyright (c) 2020 UXBOX Labs SL (ns uxbox.images "Image postprocessing." @@ -62,18 +65,10 @@ tmp (fs/create-tempfile :suffix ext) opr (doto (IMOperation.) (.addImage) - (.autoOrient) (.strip) (.thumbnail (int width) (int height) ">") (.quality (double quality)) - - ;; (.autoOrient) - ;; (.strip) - ;; (.thumbnail (int width) (int height) "^") - ;; (.gravity "center") - ;; (.extent (int width) (int height)) - ;; (.quality (double quality)) (.addImage))] (doto (ConvertCmd.) (.run opr (into-array (map str [input tmp])))) @@ -81,7 +76,7 @@ (fs/delete tmp) (ByteArrayInputStream. thumbnail-data))))) -(defn generate-thumbnail2 +(defn generate-profile-thumbnail ([input] (generate-thumbnail input nil)) ([input {:keys [quality format width height] :or {format "jpeg" diff --git a/backend/src/uxbox/services/mutations/images.clj b/backend/src/uxbox/services/mutations/images.clj index d5ad3bcc4..dcd1176d7 100644 --- a/backend/src/uxbox/services/mutations/images.clj +++ b/backend/src/uxbox/services/mutations/images.clj @@ -5,23 +5,22 @@ ;; This Source Code Form is "Incompatible With Secondary Licenses", as ;; defined by the Mozilla Public License, v. 2.0. ;; -;; Copyright (c) 2019-2020 Andrey Antukh +;; Copyright (c) 2020 UXBOX Labs SL (ns uxbox.services.mutations.images (:require [clojure.spec.alpha :as s] [datoteka.core :as fs] - [promesa.core :as p] [uxbox.common.exceptions :as ex] [uxbox.common.spec :as us] + [uxbox.common.uuid :as uuid] [uxbox.config :as cfg] [uxbox.db :as db] - [uxbox.media :as media] [uxbox.images :as images] - [uxbox.tasks :as tasks] - [uxbox.services.queries.teams :as teams] + [uxbox.media :as media] [uxbox.services.mutations :as sm] - [uxbox.common.uuid :as uuid] + [uxbox.services.queries.teams :as teams] + [uxbox.tasks :as tasks] [uxbox.util.storage :as ust] [uxbox.util.time :as dt])) @@ -29,7 +28,7 @@ {:width 800 :height 800 :quality 85 - :format "webp"}) + :format "jpeg"}) (s/def ::id ::us/uuid) (s/def ::name ::us/string) diff --git a/backend/src/uxbox/services/mutations/profile.clj b/backend/src/uxbox/services/mutations/profile.clj index 63e184135..6588339d5 100644 --- a/backend/src/uxbox/services/mutations/profile.clj +++ b/backend/src/uxbox/services/mutations/profile.clj @@ -294,12 +294,12 @@ thumb-opts {:width 256 :height 256 :quality 75 - :format "webp"} + :format "jpeg"} prefix (-> (sodi.prng/random-bytes 8) (sodi.util/bytes->b64s)) - name (str prefix ".webp") + name (str prefix ".jpg") path (fs/path (:tempfile file)) - photo (images/generate-thumbnail2 path thumb-opts)] + photo (images/generate-profile-thumbnail path thumb-opts)] (ust/save! media/media-storage name photo))) (defn- update-profile-photo