Class: Cyberweb::ImagesToHtml
- Inherits:
-
ObtainFilesAndDirectoriesFromThisPath
- Object
- Base
- ObtainFilesAndDirectoriesFromThisPath
- Cyberweb::ImagesToHtml
- Defined in:
- lib/cyberweb/utility_scripts/images_to_html/images_to_html.rb
Overview
Cyberweb::ImagesToHtml
Constant Summary
Constants inherited from ObtainFilesAndDirectoriesFromThisPath
ObtainFilesAndDirectoriesFromThisPath::ARRAY_IMAGES, ObtainFilesAndDirectoriesFromThisPath::BE_VERBOSE, ObtainFilesAndDirectoriesFromThisPath::CSS_STYLE_TO_USE_FOR_THE_TOP_HEADER, ObtainFilesAndDirectoriesFromThisPath::DEFAULT_CSS_STYLE_FOR_HYPERLINKS, ObtainFilesAndDirectoriesFromThisPath::FONT_SIZE_TO_USE, ObtainFilesAndDirectoriesFromThisPath::HTML, ObtainFilesAndDirectoriesFromThisPath::IMG_CSS_STYLE, ObtainFilesAndDirectoriesFromThisPath::INFO_DIRECTORY, ObtainFilesAndDirectoriesFromThisPath::SHALL_WE_DEBUG, ObtainFilesAndDirectoriesFromThisPath::THESE_CSS_CLASSES_ARE_KNOWN_TO_THE_RENDERED_TEMPLATE
Constants inherited from Base
Base::HOME_DIRECTORY_OF_THE_USER_X, Base::NAMESPACE
Instance Method Summary collapse
-
#append_these_images(i = array_work_on_these_files?, , files = files? ) ⇒ Object
# === append_these_images ========================================================================= #.
-
#build_up_the_HTML_string_now(array = array_work_on_these_files? ) ⇒ Object
# === build_up_the_HTML_string_now.
-
#display_width_and_height_of_the_image? ⇒ Boolean
# === display_width_and_height_of_the_image? ========================================================================= #.
-
#do_collect_all_images(target_directory = which_directory_contains_all_the_images?, , do_traverse_into_subdirectories = do_traverse_into_subdirectories?, , sort_how = sort_how? ) ⇒ Object
(also: #store_images, #append_images, #set_images, #obtain_all_images_from_the_designated_directory, #look_for_the_images_here, #look_for_the_images)
# === do_collect_all_images.
-
#do_show_names_of_image_files ⇒ Object
(also: #show_names, #show_names_of_image_files)
# === show_names_of_image_files ========================================================================= #.
-
#initialize(i = ARGV, run_already = true) ⇒ ImagesToHtml
constructor
# === initialize The first argument to this method should contain the commandline arguments, which is usually ARGV.
-
#reset ⇒ Object
# === reset (reset tag) ========================================================================= #.
-
#return_image(i) ⇒ Object
# === return_image.
-
#return_infer_the_name_from_the_directory_containing_all_images(i) ⇒ Object
# === return_infer_the_name_from_the_directory_containing_all_images ========================================================================= #.
-
#run ⇒ Object
# === run (run tag) ========================================================================= #.
-
#scan_for_images_in_current_directory ⇒ Object
# === scan_for_images_in_current_directory ========================================================================= #.
-
#scan_for_images_in_this_directory(i = return_pwd, include_subdirectories = true) ⇒ Object
(also: #scan_here, #scan_there, #scan_from, #use_this_dir=)
# === scan_for_images_in_this_directory ========================================================================= #.
-
#set_this_directory_contains_all_images(i = :pwd) ⇒ Object
(also: #set_this_directory_contains_the_images, #this_directory_contains_all_images=, #this_directory_contains_all_the_images=)
# === set_this_directory_contains_all_images ========================================================================= #.
-
#show_the_name_of_the_image_file? ⇒ Boolean
# === show_the_name_of_the_image_file? ========================================================================= #.
-
#singular_or_plural_of_the_word_image(i) ⇒ Object
# === singular_or_plural_of_the_word_image ========================================================================= #.
-
#the_three_main_actions ⇒ Object
# === the_three_main_actions ========================================================================= #.
-
#the_two_last_actions ⇒ Object
# === the_two_last_actions.
Methods inherited from ObtainFilesAndDirectoriesFromThisPath
[], #add, #add_date_in_the_lower_part_of_the_webpage?, #add_hyperlinks_to_subdirectories?, #add_the_footer_with_hyperlinks, #addnl, #append, #append_to_local_css_style, #be_verbose?, #body_css_style?, #check_whether_at_the_least_one_argument_was_given_and_then_act_accordingly, #clear_directories, #clear_files, #colour_for_pdf_files, #consider_appending_the_jquery_string, #content_of_the_HTML_page?, #directory_containing_all_files?, #display_the_top_header?, #do_debug, #do_include_subdirectories, #do_make_use_of_a_go_down_one_level_link, #do_not_include_subdirectories, #do_not_use_HTML_table_layout, #do_open_the_webpage_if_we_are_on_a_roebe_system, #do_process_all_entries_from_this_directory, #do_store_the_content, #do_traverse_into_subdirectories?, #do_use_HTML_table_layout, #files?, #filter_for_these_files, #gold, #include_subdirectories?, #make_use_of_a_go_down_one_level_link?, #mediumorchid, #mediumseagreen, #menu, #n_rows?, #olivedrab, #paleturquoise, #registered_ids?, #report_not_registered_commandline_argument, #report_scanning_directory, #return_early_and_late_year_from_this_array, #return_jquery, #return_the_code_for_going_down_one_level, #return_the_pretty_name_of_the_webpage, #royalblue, #save_into_this_local_file?, #set_background, #set_body_css_style, #set_content_of_the_html_page, #set_directory_containing_all_files, #set_files, #set_save_into_this_local_file, #shall_we_debug?, #show_help, #show_year_in_the_header?, #sort_how?, #use_HTML_table_layout?, #use_german?, #use_jquery?, #use_no_size_value?, #work_on_video_files_only?
Methods inherited from Base
#be_verbose, #be_verbose?, #cascading_style_sheets_directory?, #cd, #commandline_mode?, #copyright?, #css_comment, #delete_directory, #do_toggle, #e, #echo_raw, #filename?, #full_path_to_image_directory?, #html_colours?, #html_image, #htmlentities, #img_dir?, #infer_the_namespace, #initialize_the_configuration, #is_a_file?, #is_a_video_file?, #is_an_image_file?, #is_on_roebe?, #last_tag_used?, #last_tag_used_first_element?, #last_tag_used_id?, #mkdir, #mode?, #namespace?, #open_in_browser, #opne, #opnn, #remove_comments_from_this_string_but_preserve_CSS_rules, #remove_html, #return_all_directories, #return_date, #return_program_name, #return_pwd, #ruby_header?, #server_base_directory?, #set_commandline_mode, #set_last_tag_used, #update_the_image_directory, #use_this_relative_directory_for_custom_images?, #www_mode?
Methods included from BaseModule::FileRelatedFunctionality
#copy_this_file, #cpr, #delete_file, #filename_without_extension?, #read_file_via_utf8_encoding
Methods included from BaseModule
#attach_these_constants, #base_dir?, #beautiful_url, #cd, #create_the_internal_hash, #doctype?, #ee, #ensure_main_encoding, #esystem, #html_templates, #initialize_the_config_if_the_config_hash_is_empty, #internal_hash?, #log_dir?, #no_http, #random_alphabet_characters, #rarrow?, #rds, #remove_comments_from_this_string, #remove_numbers, #require_the_html_templates, #require_these, #return_file_size_in_kb_of, #return_html_comment, #ruby_sitelib_dir?, #sanitize_this_id, #server_base_directory?, #string_remote_image, #today?, #try_to_require_rack, #try_to_require_the_open_gem, #write_what_into
Methods included from BaseModule::ContentType
#content_type_is_html, #content_type_is_jpeg, #content_type_is_json, #content_type_is_plain_text
Methods included from BaseModule::CommandlineArguments
#append_to_the_commandline_arguments, #commandline_arguments?, #first_argument?, #parse_these_commandline_arguments, #second_argument?, #set_commandline_arguments
Methods included from BaseModule::Colours
#all_html_colours, #lightgreen, #rev, #sdir, #sfancy, #sfile, #simp, #steelblue, #tomato
Constructor Details
#initialize(i = ARGV, run_already = true) ⇒ ImagesToHtml
#
initialize
The first argument to this method should contain the commandline arguments, which is usually ARGV.
#
52 53 54 55 56 57 |
# File 'lib/cyberweb/utility_scripts/images_to_html/images_to_html.rb', line 52 def initialize( i = ARGV, run_already = true ) super(i, run_already) end |
Instance Method Details
#append_these_images(i = array_work_on_these_files?, , files = files? ) ⇒ Object
#
append_these_images
#
351 352 353 354 355 356 357 |
# File 'lib/cyberweb/utility_scripts/images_to_html/images_to_html.rb', line 351 def append_these_images( i = array_work_on_these_files?, files = files? ) files << [i].flatten.compact files.flatten! end |
#build_up_the_HTML_string_now(array = array_work_on_these_files? ) ⇒ Object
#
build_up_the_HTML_string_now
This is the method that will build up our resulting HTML string.
#
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 |
# File 'lib/cyberweb/utility_scripts/images_to_html/images_to_html.rb', line 151 def build_up_the_HTML_string_now( array = array_work_on_these_files? ) # ======================================================================= # # Next add jquery support, after the appropriate CSS was added. This # should come before the top-header is added though. # ======================================================================= # consider_appending_the_jquery_string # ======================================================================= # # === Handle the top-header next # # We have to determine whether the user wants to see a HTML-header, # via a special <div> element, with the id "top_header". If so then # this will be shown first. # ======================================================================= # if display_the_top_header? addnl("<style>\n#{CSS_STYLE_TO_USE_FOR_THE_TOP_HEADER}\n</style>\n") addnl('<div id="top_header">') addnl('<b style="color: gold">') addnl( array.size.to_s+' '+ singular_or_plural_of_the_word_image(array.size)+ '</b> will be shown next. ' ) # ===================================================================== # # Calculate the total file size of these images. # ===================================================================== # total_file_size = array.map {|entry| if File.exist?(entry) File.size(entry) else puts 'Notice: no file exists at `'+entry+'`.' 0 end }.sum n_kb = (total_file_size / 1000.0).round(1) n_mb = (n_kb / 1000.0).round(1) addnl( 'These images have a collective (total) file size of <b style="color: lightblue;">'+ n_mb.to_s+' MB</b>.' ) # ===================================================================== # # Since as of July 2023 the class may also show the year-range, e. g. # from 2001-2023. # ===================================================================== # if show_year_in_the_header? early_year, late_year = return_early_and_late_year_from_this_array(array) addnl( "<br><br>The time range of these images goes from the years "\ "<b class=\"yellowgreen\">#{early_year}</b> to "\ "<b class=\"yellowgreen\">#{late_year}</b>." ) end # ===================================================================== # # Since as of June 2023 we may append another line here. This requires # of this class to find out the name of the directory below the # current directory. # ===================================================================== # if make_use_of_a_go_down_one_level_link? addnl( return_the_code_for_going_down_one_level ) end # ===================================================================== # # And close the top-header next: # ===================================================================== # addnl('</div>') end # ======================================================================= # # Next honour the setting of using a table-layout. # ======================================================================= # if use_HTML_table_layout? addnl( '<table style="table-layout: fixed; font-size: 1.1em">' ) # This will force equally spaced cells. end # ======================================================================= # # Next add the images. Note that return_image() will handle # this situation for us. # ======================================================================= # unless array.empty? working_directory = return_pwd array.each_with_index {|this_file, index| original_this_entry = this_file.dup # =================================================================== # # this_file will refer to a String such as: # # "/home/x/data/images/fotos/cats_and_dogs/aisha/01.01.2013_Aisha_schläft_im_Bett.jpg" # # =================================================================== # # =================================================================== # # This clause is only valid if we work on video-related multimedia. # =================================================================== # if work_on_video_files_only? addnl('<div style="color: lightgreen">') addnl(HtmlTags.h2(this_file, 'lightgreen')) addnl(HtmlTags.video(this_file)) addnl("<br>") addnl("</div>") else # ================================================================= # # This clause will be entered if we use a HTML table layout. We # will show the filesize, in kb; and since as of February 2023 # we will also show the width_x_height value. # ================================================================= # if use_HTML_table_layout? and File.exist?(this_file) width_of_the_image = ImageParadise.width_of_this_image?(this_file).to_s height_of_the_image = ImageParadise.height_of_this_image?(this_file).to_s filesize_string = ''.dup if File.file?(this_file) filesize_string << ' <span style="color: lightblue">'+ '(<b>filesize</b>: <b>'+ (File.size(this_file).to_f / 1000.0).floor(0).to_s+ '</b> <b>kb</b>'.dup end if display_width_and_height_of_the_image? # ============================================================= # # Add the width and height of the image next: # ============================================================= # filesize_string << ', <b>'+width_of_the_image+'x'+ height_of_the_image.to_s+'px</b>' end filesize_string << ', <b>'+File.extname(this_file).downcase+ ' format</b>' filesize_string << ')</span>' # =============================================================== # # Determine the raw description for the image, based on the # filename itself. # =============================================================== # raw_description_of_the_image = File.basename(this_file). delete_suffix( File.extname(this_file) ). tr('_',' ') # =============================================================== # # Next make the leading date, in dd.mm.yyyy format, bold, # and put it into () parens. Since as of April 2023, if we # also have the word "etwa_" then we put this inside of the # parens afterwards. # =============================================================== # description_of_the_image = '<br><span style="font-size: 1.2em; color: gold;">'+ raw_description_of_the_image.sub( /(\d{1,2}\.?\d{1,2}\.?\d{4,4})/, '(<b>\1</b>)' )+'</span>' if description_of_the_image.include?('etwa (<b>') # See above for the explanation. description_of_the_image.sub!(/(etwa \(<b>)/,'(<b>etwa ') end this_file = File.basename(this_file) # We try this line as of October 2022. use_this_for_the_href_entry = original_this_entry.sub(/#{working_directory}/,'') case index % n_rows? when 0 # This would mean we should do a new row. addnl("<tr style=\"width:25%;\"><td style=\"width:28%\">") addnl( "<a target=\"_blank\" href=\"#{use_this_for_the_href_entry}\">#{return_image(use_this_for_the_href_entry)}#{description_of_the_image}" ) addnl("</a>#{filesize_string}</td>") when (n_rows? - 3), (n_rows? - 2) addnl("<td style=\"width: 28%\">") addnl( "<a target=\"_blank\" href=\"#{use_this_for_the_href_entry}\">#{return_image(use_this_for_the_href_entry)}#{description_of_the_image}" ) addnl("</a>#{filesize_string}</td>") when (n_rows? - 1) addnl("<td style=\"width: 28%\">") addnl( "<a target=\"_blank\" href=\"#{use_this_for_the_href_entry}\">#{return_image(use_this_for_the_href_entry)}#{description_of_the_image}" ) addnl("</a>#{filesize_string}</td></tr>") end else addnl( return_image(this_file) ) end end } end if use_HTML_table_layout? addnl( '</table>' ) # This will force equally spaced cells. end if add_hyperlinks_to_subdirectories? end end |
#display_width_and_height_of_the_image? ⇒ Boolean
#
display_width_and_height_of_the_image?
#
124 125 126 |
# File 'lib/cyberweb/utility_scripts/images_to_html/images_to_html.rb', line 124 def display_width_and_height_of_the_image? @internal_hash[:display_width_and_height_of_the_image] end |
#do_collect_all_images(target_directory = which_directory_contains_all_the_images?, , do_traverse_into_subdirectories = do_traverse_into_subdirectories?, , sort_how = sort_how? ) ⇒ Object Also known as: store_images, append_images, set_images, obtain_all_images_from_the_designated_directory, look_for_the_images_here, look_for_the_images
#
do_collect_all_images
Use this method to collect all images. The method may also obtain all images from subdirectories, if the user requested this class to do so.
In order for this method to work correctly the variable that keeps track of the main directory at hand has to be set PRIOR to calling this method.
#
370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 |
# File 'lib/cyberweb/utility_scripts/images_to_html/images_to_html.rb', line 370 def do_collect_all_images( target_directory = which_directory_contains_all_the_images?, do_traverse_into_subdirectories = do_traverse_into_subdirectories?, sort_how = sort_how? ) case target_directory # ======================================================================= # # === :return_pwd # ======================================================================= # when :return_pwd target_directory = return_pwd end if File.directory?(target_directory) case do_traverse_into_subdirectories when true, :include_the_subdirectories_as_well, :default # This is the default entry point. arguments_to_use_for_dir = "#{target_directory}/**/**" else arguments_to_use_for_dir = "#{target_directory}/*" end _ = Dir[arguments_to_use_for_dir.squeeze('/')] # ======================================================================= # # Next we must check whether we need to sort the images at hand. # ======================================================================= # if sort_how case sort_how # ===================================================================== # # === :sort_by_date # ===================================================================== # when :sort_by_date, :sort_by_time _ = ::Cyberweb.sort_this_array_by_time(_) # =================================================================== # # Next we must check for duplicate entries. # =================================================================== # temp_array = [] array_these_are_duplicate_entries = [] _.each {|entry| basename = File.basename(entry). delete_suffix(File.extname(entry)) if temp_array.include? basename array_these_are_duplicate_entries << entry end temp_array << basename } unless array_these_are_duplicate_entries.empty? shorter_array = array_these_are_duplicate_entries.map {|entry| File.basename(entry). delete_suffix(File.extname(entry)) } _ = _.sort {|file1, file2| # basename1 = File.basename(file1). # delete_suffix(File.extname(file1)) basename2 = File.basename(file2). delete_suffix(File.extname(file2)) if shorter_array.include? basename2 if File.mtime(file1) > File.mtime(file2) 1 else 0 end else 0 end # This should return 1, 0 or -1 } end end end if work_on_video_files_only? _.select! {|entry| is_a_video_file?(entry) # Filter for video files here. } else _.select! {|entry| is_an_image?(entry) # Filter for image files here. } end append_these_images(_) else e 'Please provide a valid directory containing images.' exit end end |
#do_show_names_of_image_files ⇒ Object Also known as: show_names, show_names_of_image_files
#
show_names_of_image_files
#
343 344 345 |
# File 'lib/cyberweb/utility_scripts/images_to_html/images_to_html.rb', line 343 def do_show_names_of_image_files @internal_hash[:show_the_name_of_the_image_file] = true end |
#reset ⇒ Object
#
reset (reset tag)
#
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/cyberweb/utility_scripts/images_to_html/images_to_html.rb', line 62 def reset # ======================================================================= # # Set up sane defaults first. # ======================================================================= # super() be_verbose infer_the_namespace # ======================================================================= # # === :do_traverse_into_subdirectories # ======================================================================= # @internal_hash[:do_traverse_into_subdirectories] = true # ======================================================================= # # === :display_width_and_height_of_the_image # # The next variable may lead to a slow-down of generating the .html # file at hand, so if this is not acceptable to you, set it to # false. The variable was added in February 2023 because I wanted to # display the width x height, in px, of an image, which is quite # convenient to see on a .html page as-is. # ======================================================================= # @internal_hash[:display_width_and_height_of_the_image] = true # ======================================================================= # # === :show_the_name_of_the_image_file # ======================================================================= # @internal_hash[:show_the_name_of_the_image_file] = false # ======================================================================= # # === :use_n_rows_for_the_html_table # ======================================================================= # @internal_hash[:use_n_rows_for_the_html_table] = 3 # ======================================================================= # # This class needs another base-directory. # ======================================================================= # set_save_into_this_local_file( :infer_the_name_from_the_directory_containing_all_images ) end |
#return_image(i) ⇒ Object
#
return_image
Use this when you wish to append an image.
This method will also have to create a proper ID for the image at hand, one that makes sense.
On 25.01.2023 this was changed with a generic method first defined originally in Cyberweb::WebObject some time before that day.
This method will return a String such as <img src=“foobar.png”>.
#
516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 |
# File 'lib/cyberweb/utility_scripts/images_to_html/images_to_html.rb', line 516 def return_image(i) if i.is_a? Array # Arrays should not be passed into this method. e 'An array was passed to .return_image(). This is presently not allowed.' e pp caller() e raise Exception end result = ''.dup i = rds(i) # ======================================================================= # # If we do not make use of a HTML table then we may show the name of the # image at hand, via a <h2> tag in orange colour. # ======================================================================= # if show_the_name_of_the_image_file? and !use_html_table? result << '<h2 style="color: orange; font-style: italic; padding: 5px">'+i+'</h2>'+NBR end new_filename = File.basename(i). sub(/#{File.extname(i)}/, '') id = 'drag_'+Cyberweb.sanitize_this_id(new_filename) # ======================================================================= # # Store these IDs in the global Array as well: # ======================================================================= # @internal_hash[:registered_ids] << id result << '<img id="'+id+'" style="'+IMG_CSS_STYLE+'" src="'+i+'"'.dup if use_HTML_table? result << ' width="440"' unless use_no_size_value? end result << '>'+NBR if use_jquery? result << '<script> $(function() { $( "#'+id+'" ).draggable(); }); </script>' end # puts "Debug: we return #{result}" return result end |
#return_infer_the_name_from_the_directory_containing_all_images(i) ⇒ Object
#
return_infer_the_name_from_the_directory_containing_all_images
#
131 132 133 134 135 136 137 |
# File 'lib/cyberweb/utility_scripts/images_to_html/images_to_html.rb', line 131 def return_infer_the_name_from_the_directory_containing_all_images(i) basename = File.basename(i.to_s) basename.downcase! basename << '.html' unless basename.end_with? '.html' basename = File.absolute_path(basename) return basename end |
#run ⇒ Object
#
run (run tag)
#
607 608 609 610 611 612 |
# File 'lib/cyberweb/utility_scripts/images_to_html/images_to_html.rb', line 607 def run # First invoke the method menu(). do_collect_all_images build_up_the_HTML_string_now do_store_the_content end |
#scan_for_images_in_current_directory ⇒ Object
#
scan_for_images_in_current_directory
#
117 118 119 |
# File 'lib/cyberweb/utility_scripts/images_to_html/images_to_html.rb', line 117 def scan_for_images_in_current_directory scan_for_images_in_this_directory(return_pwd) end |
#scan_for_images_in_this_directory(i = return_pwd, include_subdirectories = true) ⇒ Object Also known as: scan_here, scan_there, scan_from, use_this_dir=
#
scan_for_images_in_this_directory
#
474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 |
# File 'lib/cyberweb/utility_scripts/images_to_html/images_to_html.rb', line 474 def scan_for_images_in_this_directory( i = return_pwd, include_subdirectories = true ) if i.is_a? Array i = i.first # We only use the first argument of Arrays passed for now. end case i # ======================================================================= # # === :return_pwd # ======================================================================= # when :return_pwd i = return_pwd end case i.to_s.downcase # ======================================================================= # # === njoy # ======================================================================= # when 'njoy' i = ENV['MY_DATA'].to_s.dup+'/images/NJOY/' end i = ConvertGlobalEnv.convert(i) if i.include? '$' set_work_on_this_directory(i) look_for_the_images_here(i, :include_the_subdirectories_as_well) # This is ok because set_images will check on its own. end |
#set_this_directory_contains_all_images(i = :pwd) ⇒ Object Also known as: set_this_directory_contains_the_images, this_directory_contains_all_images=, this_directory_contains_all_the_images=
#
set_this_directory_contains_all_images
#
560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 |
# File 'lib/cyberweb/utility_scripts/images_to_html/images_to_html.rb', line 560 def set_this_directory_contains_all_images( i = :pwd ) i = i.first if i.is_a? Array case i # ======================================================================= # # === :pwd # # This entry points defaults to the current working directory. # ======================================================================= # when :pwd, :default, :return_pwd, nil i = return_pwd end if i i = i.dup if i.frozen? # Ensure that we do not have a frozen String. i << '/' unless i.end_with? '/' end set_work_on_this_directory(i) end |
#show_the_name_of_the_image_file? ⇒ Boolean
#
show_the_name_of_the_image_file?
#
142 143 144 |
# File 'lib/cyberweb/utility_scripts/images_to_html/images_to_html.rb', line 142 def show_the_name_of_the_image_file? @internal_hash[:show_the_name_of_the_image_file] end |
#singular_or_plural_of_the_word_image(i) ⇒ Object
#
singular_or_plural_of_the_word_image
#
463 464 465 466 467 468 469 |
# File 'lib/cyberweb/utility_scripts/images_to_html/images_to_html.rb', line 463 def singular_or_plural_of_the_word_image(i) if i < 2 'image' else 'images' end end |
#the_three_main_actions ⇒ Object
#
the_three_main_actions
#
588 589 590 591 |
# File 'lib/cyberweb/utility_scripts/images_to_html/images_to_html.rb', line 588 def the_three_main_actions do_collect_all_images the_two_last_actions end |
#the_two_last_actions ⇒ Object
#
the_two_last_actions
This method must return the path to the locally created file.
#
598 599 600 601 602 |
# File 'lib/cyberweb/utility_scripts/images_to_html/images_to_html.rb', line 598 def the_two_last_actions build_up_the_HTML_string_now do_store_the_content return save_into_this_local_file? end |