class ImageParadise::ImageGallery
Constants
- DIRECTORY_CONTAINING_ALL_IMAGES
#¶ ↑
ImageParadise::ImageGallery::DIRECTORY_CONTAINING_ALL_IMAGES
¶ ↑#¶ ↑
- DISPLAY_N_IMAGES_PER_ROW
#¶ ↑
ImageParadise::ImageGallery::DISPLAY_N_IMAGES_PER_ROW
¶ ↑#¶ ↑
- NAMESPACE
#¶ ↑
NAMESPACE
¶ ↑#¶ ↑
Public Class Methods
[](i = '')
click to toggle source
modify_this_key(first_key)
click to toggle source
#¶ ↑
ImageParadise::ImageGallery.modify_this_key
¶ ↑
#¶ ↑
# File lib/image_paradise/utility_scripts/image_gallery/image_gallery.rb, line 126 def self.modify_this_key(first_key) # ======================================================================= # # These are hardcoded aliases adjusted to my home system, thus not very # useful to other people. # ======================================================================= # case first_key # case tag # ======================================================================= # # === wunibald tag # ======================================================================= # when 'wunibald' first_key = 'family/wunibald_kunz/' # ======================================================================= # # === hertha tag # ======================================================================= # when 'hertha' first_key = 'family/hertha_kunz/' # ======================================================================= # # === marchettigasse tag # ======================================================================= # when 'marchettigasse' first_key = 'areas/marchettigasse_und_mollardgasse/' # ======================================================================= # # === kindergarten tag # ======================================================================= # when 'kindergarten', 'schulklasse', /kindergarten(_|-)?und(_|-)?schulklasse/ first_key = 'kindergarten_und_schulklasse/' # ======================================================================= # # === objects tag # ======================================================================= # when 'objects' first_key = 'objects/' when 'areas' first_key = 'areas/' when 'minzi' first_key = 'cats_and_dogs/minzi/' when 'fennek' first_key = 'cats_and_dogs/fennek/' when 'rausch' first_key = 'family/magdalena_rausch/' when 'friends_gemischt' first_key = 'friends/gemischt/' when 'mama' first_key = 'family/mama/' when 'papa' first_key = 'family/papa/' when 'mixed_family' first_key = 'family/gemischt/' when 'roebe' first_key = 'family/robert_kunz/' when 'mixed_cats' first_key = 'cats_and_dogs/gemischt/' when 'pizzi' first_key = 'cats_and_dogs/pizzi/' when 'silbernes' first_key = 'cats_and_dogs/silbernes/' when 'zwetschki' first_key = 'cats_and_dogs/zwetschki/' when 'aisha' first_key = 'cats_and_dogs/aisha/' when 'kappa' first_key = 'cats_and_dogs/kappa/' when 'cats' first_key = 'cats_and_dogs/' when 'nali' first_key = 'family/natalie_kunz/' end return first_key end
new( commandline_arguments = nil, run_already = true )
click to toggle source
#¶ ↑
initialize¶ ↑
#¶ ↑
# File lib/image_paradise/utility_scripts/image_gallery/image_gallery.rb, line 38 def initialize( commandline_arguments = nil, run_already = true ) reset set_commandline_arguments( commandline_arguments ) case run_already # ======================================================================= # # === :do_not_run_yet # ======================================================================= # when :do_not_run_yet run_already = false end run if run_already end
return_file_size_in_kb_of( this_file )
click to toggle source
return_full_description_of_this_image( this_image, use_this_regex = :default, optional_dataset = nil )
click to toggle source
#¶ ↑
ImageParadise::ImageGallery.return_full_description_of_this_image
¶ ↑
This method will return a String
that represents a full description of a given image. The description will solely be based on the filename itself.
#¶ ↑
# File lib/image_paradise/utility_scripts/image_gallery/image_gallery.rb, line 213 def self.return_full_description_of_this_image( this_image, use_this_regex = :default, optional_dataset = nil ) case use_this_regex # ======================================================================= # # === :default # ======================================================================= # when :default use_this_regex = /(etwa )?(\d{0,2}\.?\d{0,2}\.?\d{4})/ # See: https://rubular.com/r/Df8ezwBGIEXaEM end basename_of_the_image = File.basename(this_image) full_description = basename_of_the_image. delete_suffix(File.extname(this_image)). tr('_',' ').gsub( use_this_regex, '(<b>\1\2</b>)' )+ ' <span class="smaller">'+ '(Dateigröße: <b>'+ return_file_size_in_kb_of( File.absolute_path(this_image) ).to_s+ ' kb</b>, '.dup if optional_dataset full_description << '<b>Breite</b>: <b>'+ optional_dataset[File.absolute_path(this_image)].to_s.split('x')[0]+ '</b><b>px</b>, <b>Höhe</b>: <b>'+ optional_dataset[File.absolute_path(this_image)].to_s.split('x')[1]+ '</b><b>px</b>)</span>' else full_description << '<b>Breite</b>: <b>'+ ::ImageParadise.width_of_this_image?(File.absolute_path(this_image)).to_s+ '</b><b>px</b>, <b>Höhe</b>: <b>'+ ::ImageParadise.height_of_this_image?(File.absolute_path(this_image)).to_s+ '</b><b>px</b>)</span>' end return full_description end
Public Instance Methods
all_images?()
click to toggle source
create_a_clean_working_directory_and_cd_into_it()
click to toggle source
#¶ ↑
create_a_clean_working_directory_and_cd_into_it
¶ ↑
#¶ ↑
# File lib/image_paradise/utility_scripts/image_gallery/image_gallery.rb, line 91 def create_a_clean_working_directory_and_cd_into_it _ = '/home/Temp/image_paradise/' unless File.directory? _ mkdir_p(_) end if File.directory?(_) cd(_) e 'We are now in the directory `'+sdir(return_pwd)+'`.' end end
remove_which_string?()
click to toggle source
reset()
click to toggle source
#¶ ↑
reset (reset tag)¶ ↑
#¶ ↑
Calls superclass method
ImageParadise::Base#reset
# File lib/image_paradise/utility_scripts/image_gallery/image_gallery.rb, line 59 def reset super() # ======================================================================= # # === @namespace # ======================================================================= # @namespace = NAMESPACE # ======================================================================= # # === @remove_which_string # # This must be a regexp. # ======================================================================= # @remove_which_string = Regexp.quote( DIRECTORY_CONTAINING_ALL_IMAGES ) # ========================================================================= # # === @all_images # ========================================================================= # @all_images = rds( return_all_images_from(DIRECTORY_CONTAINING_ALL_IMAGES) ) end