Home / Function/ service.getURL() — astro Function Reference

service.getURL() — astro Function Reference

Architecture documentation for the service.getURL() function in image-service.ts from the astro codebase.

Entity Profile

Dependency Diagram

graph TD
  41d97a2f_bcc1_2729_2614_f8f61eebb550["service.getURL()"]
  ef05f0b4_0d78_c126_2b89_f6c45f336291["image-service.ts"]
  41d97a2f_bcc1_2729_2614_f8f61eebb550 -->|defined in| ef05f0b4_0d78_c126_2b89_f6c45f336291
  style 41d97a2f_bcc1_2729_2614_f8f61eebb550 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/integrations/cloudflare/src/entrypoints/image-service.ts lines 10–36

	getURL: (options, imageConfig) => {
		const resizingParams = ['onerror=redirect'];
		if (options.width) resizingParams.push(`width=${options.width}`);
		if (options.height) resizingParams.push(`height=${options.height}`);
		if (options.quality) resizingParams.push(`quality=${options.quality}`);
		if (options.fit) resizingParams.push(`fit=${options.fit}`);
		if (options.format) resizingParams.push(`format=${options.format}`);

		let imageSource = '';
		if (isESMImportedImage(options.src)) {
			imageSource = options.src.src;
		} else if (isRemoteAllowed(options.src, imageConfig)) {
			imageSource = options.src;
		} else {
			// If it's not an imported image, nor is it allowed using the current domains or remote patterns, we'll just return the original URL
			return options.src;
		}

		const imageEndpoint = joinPaths(
			import.meta.env.BASE_URL,
			'/cdn-cgi/image',
			resizingParams.join(','),
			imageSource,
		);

		return imageEndpoint;
	},

Domain

Subdomains

Frequently Asked Questions

What does service.getURL() do?
service.getURL() is a function in the astro codebase, defined in packages/integrations/cloudflare/src/entrypoints/image-service.ts.
Where is service.getURL() defined?
service.getURL() is defined in packages/integrations/cloudflare/src/entrypoints/image-service.ts at line 10.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free