code: public static String getExternalGraphicFormat( String name ) {
          String format = "";
          if (name.toLowerCase().endsWith(".png")) {
              format = "image/png";
          } else if (name.toLowerCase().endsWith(".jpg")) {
              format = "image/jpg";
          } else if (name.toLowerCase().endsWith(".gif")) {
              format = "image/gif";
          } else if (name.toLowerCase().endsWith(".svg")) {
              format = "image/svg+xml";
          } else {
              return null;
          }
  
          return format;
      }
docs: Get the format of an {@link ExternalGraphic} from its path or name.
  
  @param name the path or file name to test against.
  @return teh format definition.