Creates a URL to a plain image map.

Options:
- escape: defaults to true (Deprecated as of CakePHP 3.5.1 and now has to be always false)

@param array $options
- see staticMap() for details
@return string urlOfImage: http://...
763145
public function staticMapUrl(array $options = []) {
		$mapUrl = $this->_protocol() . static::STATIC_API;
		/*
		$params = array(
			'mobile' => 'false',
			'format' => 'png',
			//'center' => false
		);

		if (!empty($options['mobile'])) {
			$params['mobile'] = 'true';
		}
		*/

		$defaults = $this->_config['staticMap'] + $this->_config;

		$mapOptions = $options + $defaults;

		$params = array_intersect_key($mapOptions, [
			'mobile' => null,
			'format' => null,
			'size' => null,
			//'zoom' => null,
			//'lat' => null,
			//'lng' => null,
			//'visible' => null,
			//'type' => null,
		]);

		// add API key to parameters.
		if ($this->_runtimeConfig['key']) {
			$params['key'] = $this->_runtimeConfig['key'];
		}

		// do we want zoom to auto-correct itself?
		if (!isset($options['zoom']) && !empty($mapOptions['markers']) || !empty($mapOptions['paths']) || !empty($mapOptions['visible'])) {
			$options['zoom'] = 'auto';
		}

		// a position on the map that is supposed to stay visible at all cost
		if (!empty($mapOptions['visible'])) {
			$params['visible'] = urlencode($mapOptions['visible']);
		}

		// center and zoom are not necessary if path, visible or markers are given
		if (!isset($options['center']) || $options['center'] === false) {
			// dont use it
		} elseif ($options['center'] === true && $mapOptions['lat'] !== null && $mapOptions['lng'] !== null) {
			$params['center'] = urlencode((string)$mapOptions['lat'] . ',' . (string)$mapOptions['lng']);
		} elseif (!empty($options['center'])) {
			$params['center'] = urlencode($options['center']);
		} /*else {
			// try to read from markers array???
			if (isset($options['markers']) && count($options['markers']) == 1) {
				//pr ($options['markers']);
			}
		}*/

		if (!isset($options['zoom']) || $options['zoom'] === false) {
			// dont use it
		} else {
			if ($options['zoom'] === 'auto') {
				if (!empty($options['markers']) && strpos($options['zoom'], '|') !== false) {
					// let google find the best zoom value itself
				} else {
					// do something here?
				}
			} else {
				$params['zoom'] = $options['zoom'];
			}
		}

		if (array_key_exists($mapOptions['type'], $this->types)) {
			$params['maptype'] = $this->types[$mapOptions['type']];
		} else {
			$params['maptype'] = $mapOptions['type'];
		}
		$params['maptype'] = strtolower($params['maptype']);

		// old: {latitude},{longitude},{color}{alpha-character}
		// new: @see staticMarkers()
		if (!empty($options['markers'])) {
			$params['markers'] = $options['markers'];
		}

		if (!empty($options['paths'])) {
			$params['path'] = $options['paths'];
		}

		// valXval
		if (!empty($options['size'])) {
			$params['size'] = $options['size'];
		}

		$pieces = [];
		foreach ($params as $key => $value) {
			if (is_array($value)) {
				$value = implode('&' . $key . '=', $value);
			} elseif ($value === true) {
				$value = 'true';
			} elseif ($value === false) {
				$value = 'false';
			} elseif ($value === null) {
				continue;
			}
			$pieces[] = $key . '=' . $value;
		}

		$options += [
			'escape' => true,
		];
		$query = implode('&', $pieces);
		if ($options['escape']) {
			$query = h($query);
		}

		return $mapUrl . '?' . $query;
	}
108006
public function getUrl(UrlOptionsInterface $options = \null): string
    {
        $query = \null !== $options ? '?'.$options->getQueryString() : '';

        return parent::getUrl().$query;
    }
878799
public function img($file, array $params, $options = [])
    {
        $cacheFileSrc = $this->make($file, $params);

        if (!$cacheFileSrc) {
            if (isset($params['placeholder'])) {
                return $this->placeholder($params['placeholder'], $options);
            } else {
                return null;
            }
        }

        return Html::img($cacheFileSrc, $options);
    }
716483
public function form($image, $options=array()){

        $data = array();
        
        $data['image'] = base64_encode($image);

        $data = array_merge($data, $options);

        return $this->request($this->formUrl, $data);
    }
1372833
public function passport($image, $options=array()){

        $data = array();
        
        $data['image'] = base64_encode($image);

        $data = array_merge($data, $options);

        return $this->request($this->passportUrl, $data);
    }
863272
private function path($file, array $options = []) {
        // get base and full paths
        $base = $this->Url->assetUrl($file, $options);
        $fullpath = preg_replace('/^' . preg_quote($this->request->getAttribute('webroot'), '/') . '/', '', urldecode($base));

        // do webroot path
        $webrootPath = Configure::read('App.wwwRoot') . str_replace('/', DS, $fullpath);
        if(file_exists($webrootPath))
            return $webrootPath;

        // do plugin webroot path
        $pluginFile = $this->_getPluginFile($fullpath);
        if($pluginFile !== null && file_exists($pluginFile))
            return $pluginFile;

        // not found?
        return false;
    }
227668
public static function image($image, $options = [])
	{
		$static = new static;

		$static->image = $image;
		$static->options = $options;
		$static->intervention = new ImageManager(['driver' => 'gd']);

		$static->normalizeNames();

		return $static;
	}
508664
public function setOptions(array $options) {
    foreach ($options as $key => $value) {
      if (is_int($key)) {
        $option  = '--' . $value;
      }
      elseif (strlen($key) == 1) {
        $option = '-' . $key;
        if (!empty($value)) {
          $option .= ' ' . escapeshellarg($value);
        }
      }
      else {
        // Do not render --uri=default.
        if ($key == 'uri' && $value == 'default') {
          continue;
        }
        $option = '--' . $key;
        if (!empty($value)) {
          $option .= '=' . escapeshellarg($value);
        }
      }
      if (!in_array($option, $this->options)) {
        $this->options[] = $option;
      }
    }
    return $this;
  }
569793
public static function download_archive_url($options = array())
    {
        $options["mode"] = "download";
        $params = Cloudinary::build_archive_params($options);
        $params = Cloudinary::sign_request($params, $options);

        return Cloudinary::cloudinary_api_url("generate_archive", $options) . "?" .
            preg_replace("/%5B\d+%5D/", "%5B%5D", http_build_query($params));
    }
943257
public function build_url( $url, $options = array() ) {

		$url = (array) $url;

		$allow_port = (int) pods_v( static::$type . '_allow_port', $options, 0 );

		// If port is not allowed, always set to empty
		if ( 0 === $allow_port ) {
			$url['port'] = '';
		}

		if ( function_exists( 'http_build_url' ) ) {
			return http_build_url( $url );
		}

		$defaults = array(
			'scheme'   => 'http',
			'host'     => '',
			'port'     => '',
			'path'     => '/',
			'query'    => '',
			'fragment' => '',
		);

		$url = array_merge( $defaults, $url );

		$new_url = array();

		$new_url[] = trim( $url['scheme'] . '://', ':' );
		$new_url[] = $url['host'];

		if ( ! empty( $url['port'] ) ) {
			$new_url[] = ':' . $url['port'];
		}

		$new_url[] = '/' . ltrim( $url['path'], '/' );

		if ( ! empty( $url['query'] ) ) {
			$new_url[] = '?' . ltrim( $url['query'], '?' );
		}

		if ( ! empty( $url['fragment'] ) ) {
			$new_url[] = '#' . ltrim( $url['fragment'], '#' );
		}

		// Pull all of the parts back together
		$new_url = implode( '', $new_url );

		return $new_url;

	}
299230
public static function image($url, $name = null, $options = [])
    {
        $options['src'] = $url;

        self::exclure($options);

        return self::input('image', $name, null, $options);
    }
906919
public static function generate($options)
    {
        if (isset($options['keywords'])) {
            $options['keywords'] = static::printWords($options['keywords']);
        }

        return sprintf(
            static::TEMPLATE,
            $options['name'],
            $options['class'],
            $options['link'],
            $options['keywords']
        );
    }
696636
public function getCaptchaCode(array &$options)
    {
        $this->builder->setPhrase($this->getPhrase($options));

        // Randomly execute garbage collection and returns the image filename
        if ($options['as_file']) {
            $this->imageFileHandler->collectGarbage();

            return $this->generate($options);
        }

        // Returns the image generation URL
        if ($options['as_url']) {
            return $this->router->generate('gregwar_captcha.generate_captcha', 
                array('key' => $options['session_key'], 'n' => md5(microtime(true).mt_rand())));
        }

        return 'data:image/jpeg;base64,' . base64_encode($this->generate($options));
    }
123383
public function qrcode($image, $options=array()){

        $data = array();
        
        $data['image'] = base64_encode($image);

        $data = array_merge($data, $options);

        return $this->request($this->qrcodeUrl, $data);
    }
1002241
public function createUrl($path = '', $options = array())
    {

        $builtUrl = '';
        $hasHttp = stristr($path, 'http://') || stristr($path, 'https://');

        if (!empty($options['addServer']) && !$hasHttp) {
            $builtUrl .= $this->_server;
        }

        if (!stristr($path, self::URL_PREFIX) && !$hasHttp) {
            $builtUrl .= self::URL_PREFIX . '/' . self::API_VERSION;
        }

        $builtUrl .= $path;

        if (!empty($options['addMethod']) || !empty($options['addToken'])) {
            $builtUrl .= (stristr($path, '?') ? '&' : '?');
        }

        if (!empty($options['addMethod'])) {
            $builtUrl .= '_method=' . $options['addMethod'];
        }
        if (!empty($options['addToken'])) {
            $builtUrl .= ($options['addMethod'] ? '&' : '') . 'access_token=' . $this->_auth->accessToken();
        }

        return $builtUrl;

    }
422314
public function asImage($value, $options = [])
    {
        if ($value === null) {
            return $this->getNullDisplay();
        }

        return Html::img($value, $options);
    }
1005705
public function saveFromString($image, $options = array())
    {
        if (isset($options['file'])) {
            if (false === @file_put_contents($options['file'], $image)) {
                throw new Exception\RuntimeException('could not save image');
            }
            return $options['file'];
        }
        return $image;
    }