/** * Returns the thumbnail URL. * * @return string The thumbnail URL. */ public function volatile_get_url() { global $core; $src = $this->src; $options = Version::filter($this->options); $version_name = $this->version_name; $url = '/api/'; $w = $this->w; $h = $this->h; $method = $this->method; if (is_string($src)) { $url .= 'thumbnail'; $options['src'] = $src; $options['version'] = $version_name; if ($w || $h) { $url .= '/'; if ($w && $h) { $url .= $w . 'x' . $h; } else { if ($w) { $url .= $w; $method = 'fixed-width'; } else { if ($h) { $url .= 'x' . $h; $method = 'fixed-height'; } } } unset($options['width']); unset($options['height']); if ($method) { $url .= '/' . $method; unset($options['method']); } } } else { $url .= (empty($src->constructor) ? $src->model_id : $src->constructor) . '/' . $src->nid; if ($version_name) { $url .= '/thumbnails/' . $version_name; } else { if ($w || $h) { $url .= '/'; if ($w && $h) { $url .= $w . 'x' . $h; } else { if ($w) { $url .= $w; $method = 'fixed-width'; } else { if ($h) { $url .= 'x' . $h; $method = 'fixed-height'; } } } unset($options['width']); unset($options['height']); if ($method) { $url .= '/' . $method; unset($options['method']); } } else { $url .= '/thumbnail'; } } } if ($options) { $url .= '?' . http_build_query(Version::shorten($options)); } return $url; }