Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,15 @@ gem("xmlrpc")
gem("fastimage")
# for detecting file type of uploaded images
gem("mimemagic")
# An interface between Ruby and ImageMagick/Vips
gem("image_processing")
# NOTE: gem "exiftool/exiftool_vendored" is for reading only
# This supports writing (plus reading) EXIF data, "vendors" latest exiftool.
# If reading/writing multiple files at once, switch to "multi_exiftool" gem.
gem("mini_exiftool_vendored")
# syncronize files between remote hosts by wrapping a call to the rsync binary
# used in transfers to the image server
gem("rsync")

# for creating zip files
# RubyZip 3.0 is coming!
Expand Down
13 changes: 13 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,9 @@ GEM
hashdiff (1.1.0)
i18n (1.14.5)
concurrent-ruby (~> 1.0)
image_processing (1.12.2)
mini_magick (>= 4.9.5, < 5)
ruby-vips (>= 2.0.17, < 3)
importmap-rails (2.0.1)
actionpack (>= 6.0.0)
activesupport (>= 6.0.0)
Expand Down Expand Up @@ -184,6 +187,10 @@ GEM
mimemagic (0.4.3)
nokogiri (~> 1)
rake
mini_exiftool (2.11.0)
mini_exiftool_vendored (9.2.7.v1)
mini_exiftool (>= 1.6.0)
mini_magick (4.12.0)
mini_mime (1.1.5)
mini_racer (0.12.0)
libv8-node (~> 21.7.2.0)
Expand Down Expand Up @@ -279,6 +286,7 @@ GEM
chunky_png (~> 1.0)
rqrcode_core (~> 1.0)
rqrcode_core (1.2.0)
rsync (1.0.9)
rtf (0.3.3)
rubocop (1.64.1)
json (~> 2.3)
Expand All @@ -304,6 +312,8 @@ GEM
rubocop-thread_safety (0.5.1)
rubocop (>= 0.90.0)
ruby-progressbar (1.13.0)
ruby-vips (2.2.1)
ffi (~> 1.12)
rubyzip (2.3.2)
sass-embedded (1.77.4-arm64-darwin)
google-protobuf (>= 3.25, < 5.0)
Expand Down Expand Up @@ -419,9 +429,11 @@ DEPENDENCIES
debug
fastimage
i18n
image_processing
importmap-rails
jbuilder
mimemagic
mini_exiftool_vendored
mini_racer
minitest
minitest-reporters
Expand All @@ -436,6 +448,7 @@ DEPENDENCIES
redis (~> 4.0)
requestjs-rails
rqrcode
rsync
rtf
rubocop
rubocop-performance
Expand Down
25 changes: 16 additions & 9 deletions app/models/image.rb
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,7 @@ def input_stream?(file)
def init_image_from_local_file(file)
@file = file
raise("Weird: file.path is blank!") if file.path.blank?

self.upload_temp_file = file.path
self.upload_length = file.size
add_extra_attributes_from_file(file)
Expand Down Expand Up @@ -709,15 +710,21 @@ def process_image(strip: false)
update_attribute(:gps_stripped, true) if strip
strip = strip ? "1" : "0"
if move_original
cmd = MO.process_image_command.
gsub("<id>", id.to_s).
gsub("<ext>", ext).
gsub("<set>", set).
gsub("<strip>", strip)
if !Rails.env.test? && !system(cmd)
errors.add(:image, :runtime_image_process_failed.t(id: id))
result = false
end
args = {
image: self, ext: ext, set_size: set, strip_gps: strip, user: user
}
processor = Image::Processor.new(args)
processor.process

# cmd = MO.process_image_command.
# gsub("<id>", id.to_s).
# gsub("<ext>", ext).
# gsub("<set>", set).
# gsub("<strip>", strip)
# if !Rails.env.test? && !system(cmd)
# errors.add(:image, :runtime_image_process_failed.t(id: id))
# result = false
# end
else
result = false
end
Expand Down
Loading