bin/magick.rb
def image_magick_params(full_path)
  params = Hash.new

  begin
    # Add default paramaters if any and allowed.
    if !DEFAULTS.nil? and USE_DEFAULTS
      params.merge!(pair_array_to_hash(DEFAULTS.split('/')))
    end

    # Add path params if there are any and allowed.
    if USE_PARAMS
      path_params = full_path.split("/#{SPLIT_CHAR}/")
      if path_params.count > 1
        params.merge!(pair_array_to_hash(path_params.first.split('/').reject(&:empty?)))
      end
    end

    # Add template if requested and allowed
    if !params[TEMPLATE_MARK].nil? and USE_TEMPLATES
      templates = TEMPLATES.split('&')
      template_params = templates[templates.index(params[TEMPLATE_MARK]) + 1]
      params.merge!(pair_array_to_hash(template_params.split('/')))
      params.delete(TEMPLATE_MARK)
    end
  rescue
    # Load 404 on bad provided paramaters.
    puts $!.inspect, $@
    return false #404
  end
  params
end
# Get image conversion paramaters from full path and return hash.
Get image conversion paramaters from full path and return hash.
Get image conversion paramaters from full path and return hash .
def image_magick_params(full_path)
  params = Hash.new
  begin
    if !DEFAULTS.nil? and USE_DEFAULTS
      params.merge!(pair_array_to_hash(DEFAULTS.split('/')))
    end
    if USE_PARAMS
      path_params = full_path.split("/#{SPLIT_CHAR}/")
      if path_params.count > 1
        params.merge!(pair_array_to_hash(path_params.first.split('/').reject(&:empty?)))
      end
    end
    if !params[TEMPLATE_MARK].nil? and USE_TEMPLATES
      templates = TEMPLATES.split('&')
      template_params = templates[templates.index(params[TEMPLATE_MARK]) + 1]
      params.merge!(pair_array_to_hash(template_params.split('/')))
      params.delete(TEMPLATE_MARK)
    end
  rescue
    puts $!.inspect, $@
    return false 
  end
  params
end
def image_magick_params ( full_path ) params = Hash . new begin if ! DEFAULTS . nil? and USE_DEFAULTS params . merge! ( pair_array_to_hash ( DEFAULTS . split ( '/' ) ) ) end if USE_PARAMS path_params = full_path . split ( "/#{SPLIT_CHAR}/" ) if path_params . count > 1 params . merge! ( pair_array_to_hash ( path_params . first . split ( '/' ) . reject ( & :empty? ) ) ) end end if ! params [ TEMPLATE_MARK ] . nil? and USE_TEMPLATES templates = TEMPLATES . split ( '&' ) template_params = templates [ templates . index ( params [ TEMPLATE_MARK ] ) + 1 ] params . merge! ( pair_array_to_hash ( template_params . split ( '/' ) ) ) params . delete ( TEMPLATE_MARK ) end rescue puts $! . inspect , $@ return false end params end
Get image conversion paramaters from full path and return hash.
Get image conversion paramaters from full path and return hash .
# Add default paramaters if any and allowed. # Add path params if there are any and allowed. # Add template if requested and allowed # Load 404 on bad provided paramaters. #404
full_path