mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-11-30 14:57:59 +01:00
Merge branch 'orig-size' into deadweight-elimination
This commit is contained in:
commit
4ef45327c1
8 changed files with 23 additions and 2 deletions
|
@ -42,6 +42,7 @@ metadata: image_search_json
|
|||
'processed', processed,
|
||||
'score', score,
|
||||
'size', image_size,
|
||||
'orig_size', image_orig_size,
|
||||
'sha512_hash', image_sha512_hash,
|
||||
'thumbnails_generated', thumbnails_generated,
|
||||
'updated_at', updated_at,
|
||||
|
|
|
@ -51,6 +51,7 @@ defmodule Philomena.Images.Image do
|
|||
field :image_width, :integer
|
||||
field :image_height, :integer
|
||||
field :image_size, :integer
|
||||
field :image_orig_size, :integer
|
||||
field :image_format, :string
|
||||
field :image_mime_type, :string
|
||||
field :image_aspect_ratio, :float
|
||||
|
@ -137,6 +138,7 @@ defmodule Philomena.Images.Image do
|
|||
:image_width,
|
||||
:image_height,
|
||||
:image_size,
|
||||
:image_orig_size,
|
||||
:image_format,
|
||||
:image_mime_type,
|
||||
:image_aspect_ratio,
|
||||
|
@ -152,6 +154,7 @@ defmodule Philomena.Images.Image do
|
|||
:image_width,
|
||||
:image_height,
|
||||
:image_size,
|
||||
:image_orig_size,
|
||||
:image_format,
|
||||
:image_mime_type,
|
||||
:image_aspect_ratio,
|
||||
|
|
|
@ -84,7 +84,7 @@ defmodule Philomena.Images.Query do
|
|||
defp anonymous_fields do
|
||||
[
|
||||
int_fields:
|
||||
~W(id width height score upvotes downvotes faves uploader_id faved_by_id pixels size comment_count source_count tag_count) ++
|
||||
~W(id width height score upvotes downvotes faves uploader_id faved_by_id pixels size orig_size comment_count source_count tag_count) ++
|
||||
tag_count_fields(),
|
||||
float_fields: ~W(aspect_ratio wilson_score duration),
|
||||
date_fields: ~W(created_at updated_at first_seen_at),
|
||||
|
|
|
@ -54,6 +54,7 @@ defmodule Philomena.Images.SearchIndex do
|
|||
processed: %{type: "boolean"},
|
||||
score: %{type: "integer"},
|
||||
size: %{type: "integer"},
|
||||
orig_size: %{type: "integer"},
|
||||
sha512_hash: %{type: "keyword"},
|
||||
source_url: %{type: "keyword"},
|
||||
source_count: %{type: "integer"},
|
||||
|
@ -117,6 +118,7 @@ defmodule Philomena.Images.SearchIndex do
|
|||
height: image.image_height,
|
||||
pixels: image.image_width * image.image_height,
|
||||
size: image.image_size,
|
||||
orig_size: image.image_orig_size,
|
||||
animated: image.image_is_animated,
|
||||
duration: if(image.image_is_animated, do: image.image_duration, else: 0),
|
||||
tag_count: length(image.tags),
|
||||
|
|
|
@ -130,6 +130,7 @@ defmodule PhilomenaMedia.Uploader do
|
|||
* `width` (integer) - the width of the file
|
||||
* `height` (integer) - the height of the file
|
||||
* `size` (integer) - the size of the file, in bytes
|
||||
* `orig_size` (integer) - the size of the file, in bytes
|
||||
* `format` (String) - the file extension, one of `~w(gif jpg png svg webm)`, determined by reading the file
|
||||
* `mime_type` (String) - the file's sniffed MIME type, determined by reading the file
|
||||
* `duration` (float) - the duration of the media file
|
||||
|
@ -148,6 +149,7 @@ defmodule PhilomenaMedia.Uploader do
|
|||
:foo_width,
|
||||
:foo_height,
|
||||
:foo_size,
|
||||
:foo_orig_size,
|
||||
:foo_format,
|
||||
:foo_mime_type,
|
||||
:foo_duration,
|
||||
|
@ -221,6 +223,7 @@ defmodule PhilomenaMedia.Uploader do
|
|||
"width" => analysis.width,
|
||||
"height" => analysis.height,
|
||||
"size" => analysis.size,
|
||||
"orig_size" => analysis.size,
|
||||
"format" => analysis.extension,
|
||||
"mime_type" => analysis.mime_type,
|
||||
"duration" => analysis.duration,
|
||||
|
|
|
@ -60,6 +60,7 @@ defmodule PhilomenaWeb.Api.Json.ImageView do
|
|||
height: image.image_height,
|
||||
mime_type: image.image_mime_type,
|
||||
size: image.image_size,
|
||||
orig_size: image.image_orig_size,
|
||||
duration: image.image_duration,
|
||||
animated: image.image_is_animated,
|
||||
format: image.image_format,
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
defmodule Philomena.Repo.Migrations.AddImagesOrigSize do
|
||||
use Ecto.Migration
|
||||
|
||||
def change do
|
||||
alter table("images") do
|
||||
add :image_orig_size, :integer
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1034,7 +1034,8 @@ CREATE TABLE public.images (
|
|||
image_duration double precision,
|
||||
description character varying DEFAULT ''::character varying NOT NULL,
|
||||
scratchpad character varying,
|
||||
approved boolean DEFAULT false
|
||||
approved boolean DEFAULT false,
|
||||
image_orig_size integer
|
||||
);
|
||||
|
||||
|
||||
|
@ -5445,3 +5446,4 @@ INSERT INTO public."schema_migrations" (version) VALUES (20211107130226);
|
|||
INSERT INTO public."schema_migrations" (version) VALUES (20211219194836);
|
||||
INSERT INTO public."schema_migrations" (version) VALUES (20220321173359);
|
||||
INSERT INTO public."schema_migrations" (version) VALUES (20240707191353);
|
||||
INSERT INTO public."schema_migrations" (version) VALUES (20240723122759);
|
||||
|
|
Loading…
Reference in a new issue