/*
Get the url of the image for the given conversionName
for first media for the given collectionName.
If no profile is given, return the source's url.
178008
public function getFirstTemporaryUrl(DateTimeInterface $expiration, string $collectionName = 'default', string $conversionName = ''): string
    {
        $media = $this->getFirstMedia($collectionName);

        if (! $media) {
            return '';
        }

        return $media->getTemporaryUrl($expiration, $conversionName);
    }
1097501
def getURL(self, size='Medium', urlType='url'):
        
        method = 'flickr.photos.getSizes'
        data = _doget(method, photo_id=self.id)
        for psize in data.rsp.sizes.size:
            if psize.label == size:
                return getattr(psize, urlType)
        raise FlickrError, "No URL found"
419095
private static String getDownloadUrl(String bucket, String objectName) {
    return String.format(GCS_URL_FORMAT, bucket, objectName);
  }
361651
@RequestMapping(value = "/getThumbnail.action", method = RequestMethod.GET)
    public ResponseEntity<?> getThumbnail(@RequestParam Integer id) {

        final HttpHeaders responseHeaders = new HttpHeaders();
        Map<String, Object> responseMap;

        try {
            // try to get the image
            ImageFile image = service.findById(id);
            if (image == null) {
                throw new Exception("Could not find the image with id " + id);
            }

            byte[] imageBytes = null;

            imageBytes = image.getThumbnail();

            responseHeaders.setContentType(
                MediaType.parseMediaType(image.getFileType()));

            LOG.info("Successfully got the image thumbnail " +
                image.getFileName());

            return new ResponseEntity<byte[]>(
                imageBytes, responseHeaders, HttpStatus.OK);
        } catch (Exception e) {
            final String errorMessage = "Could not get the image thumbnail: "
                + e.getMessage();

            LOG.error(errorMessage);
            responseMap = ResultSet.error(errorMessage);

            responseHeaders.setContentType(MediaType.APPLICATION_JSON);

            return new ResponseEntity<Map<String, Object>>(
                responseMap, responseHeaders, HttpStatus.OK);
        }
    }
940790
function(query) {
        var url;

        if (query && query.users().length) {
            // When one or more users are specified, use the global images endpoint
            url = this.getResourceUrl({
                path: '/images',
                user: null
            });
        } else {
            url = this.getUserUrl();
            url.setPath(url.getPath() + '/images');
        }

        if (query) {
            url.setQueryString(query.toString());
        }

        return url;
    }
502125
public String getImageUrl() {
    if (thumbnailUrl != null) {
      return thumbnailUrl;
    }

    if (image != null) {
      return image.url;
    }

    return null;
  }
1115044
private URL convertUrl(StringBuilder searchUrl) throws FanartTvException {
        try {
            LOG.trace("URL: {}", searchUrl.toString());
            return new URL(searchUrl.toString());
        } catch (MalformedURLException ex) {
            LOG.warn(FAILED_TO_CREATE_URL, searchUrl.toString(), ex.toString());
            throw new FanartTvException(ApiExceptionType.INVALID_URL, "Unable to conver String to URL", 0, searchUrl.toString(), ex);
        }
    }
886963
public URL generateV4GetObjectSignedUrl(String bucketName, String objectName)
      throws StorageException {
    // [START storage_generate_signed_url_v4]
    // Instantiate a Google Cloud Storage client
    Storage storage = StorageOptions.getDefaultInstance().getService();

    // The name of a bucket, e.g. "my-bucket"
    // String bucketName = "my-bucket";

    // The name of an object, e.g. "my-object"
    // String objectName = "my-object";

    // Define resource
    BlobInfo blobinfo = BlobInfo.newBuilder(BlobId.of(bucketName, objectName)).build();

    // Generate Signed URL
    URL url =
        storage.signUrl(blobinfo, 15, TimeUnit.MINUTES, Storage.SignUrlOption.withV4Signature());

    System.out.println("Generated GET signed URL:");
    System.out.println(url);
    System.out.println("You can use this URL with any user agent, for example:");
    System.out.println("curl '" + url + "'");
    // [END storage_generate_signed_url_v4]
    return url;
  }
1236621
protected String getRewrittenImagePath(String originalCssPath, String newCssPath, String url) throws IOException {

		String imgUrl = null;

		// Retrieve the current CSS file from which the CSS image is referenced
		boolean generatedImg = false;
		if (binaryRsHandler != null) {
			GeneratorRegistry imgRsGeneratorRegistry = binaryRsHandler.getConfig().getGeneratorRegistry();
			generatedImg = imgRsGeneratorRegistry.isGeneratedBinaryResource(url);
		}

		String fullImgPath = PathNormalizer.concatWebPath(originalCssPath, url);
		if (!generatedImg) {

			// Add image servlet path in the URL, if it's defined
			if (StringUtils.isNotEmpty(binaryServletPath)) {
				fullImgPath = binaryServletPath + JawrConstant.URL_SEPARATOR + fullImgPath;
			}
			imgUrl = PathNormalizer.getRelativeWebPath(PathNormalizer.getParentPath(newCssPath), fullImgPath);

		} else {
			imgUrl = url;
		}

		return imgUrl;
	}
1031349
function getURL( repository ) {
    var repourl;

    if (typeof repository === 'object') {
        repourl = repository.url;
    } else {
        repourl = repository
    };

    return repourl;
}
562304
public String getResourceUrl(String bucketName, String key) {
        try {
            return getUrl(bucketName, key).toString();
        } catch ( Exception e ) {
            return null;
        }
    }
16259
public String getNavImageURL(WebSiteRequest req, HttpServletResponse resp, Object params) throws IOException, SQLException {
		return resp.encodeURL(req.getContextPath()+req.getURL(this, params));
	}
288446
def thumbnail_url(source, alias):
    
    try:
        thumb = get_thumbnailer(source)[alias]
    except Exception:
        return ''
    return thumb.url
252335
function getUrl(file, size, media) {
      media = media || get_media;
      var version = new Date(file.updatedAt).valueOf();
      return media(file.location, size) + '?version=' + version;
    }
1300640
public function getPath(string $conversionName = ''): string
    {
        $urlGenerator = UrlGeneratorFactory::createForMedia($this, $conversionName);

        return $urlGenerator->getPath();
    }
599795
private String buildDownloadMediaUrl() {
    String resourcePath = this.resource.getPath();

    // if parent resource is a nt:file resource, use this one as path for scaled image
    Resource parentResource = this.resource.getParent();
    if (JcrBinary.isNtFile(parentResource)) {
      resourcePath = parentResource.getPath();
    }

    // URL to render scaled image via {@link InlineRenditionServlet}
    String path = resourcePath + "." + MediaFileServlet.SELECTOR
        + "." + MediaFileServlet.SELECTOR_DOWNLOAD
        + "." + MediaFileServlet.EXTENSION + "/" + getFileName();

    // build externalized URL
    UrlHandler urlHandler = AdaptTo.notNull(this.adaptable, UrlHandler.class);
    return urlHandler.get(path).urlMode(this.mediaArgs.getUrlMode()).buildExternalResourceUrl(this.resource);
  }
770065
def img_url(obj, profile_app_name, profile_model_name):
    
    try:
        content_type = ContentType.objects.get(
            app_label=profile_app_name,
            model=profile_model_name.lower()
        )
    except ContentType.DoesNotExist:
        return ""
    except AttributeError:
        return ""

    Profile = content_type.model_class()
    fields = Profile._meta.get_fields()
    profile = content_type.model_class().objects.get(user=obj.user)
    for field in fields:
        if hasattr(field, "upload_to"):
            return field.value_from_object(profile).url