---
title: "RemoteImageFetcher – API reference · Quittio"
description: "Downloads remote logos without server-side request forgery: only http and https, only hosts whose every resolved address (IPv4 and IPv6) is publicly routable, the connection pinned to the checked address (no second DNS lookup) and every redirect checked again."
canonical_url: "https://quittio.dev/en/docs/api/Quittio/Core/Pdf/RemoteImageFetcher"
locale: en
meta:
  "og:description": "Downloads remote logos without server-side request forgery: only http and https, only hosts whose every resolved address (IPv4 and IPv6) is publicly routable, the connection pinned to the checked address (no second DNS lookup) and every redirect checked again."
  "og:image": "https://quittio.dev/og/quittio-en.jpg"
  "og:image:alt": "Quittio: Invoices, settled. E-invoicing for PHP and Laravel, with a validated sample invoice."
  "og:image:height": "630"
  "og:image:type": image/jpeg
  "og:image:width": "1200"
  "og:title": "RemoteImageFetcher – API reference · Quittio"
  "twitter:image": "https://quittio.dev/og/quittio-en.jpg"
  "twitter:image:alt": "Quittio: Invoices, settled. E-invoicing for PHP and Laravel, with a validated sample invoice."
---

> Index of every page on this site: [llms.txt](https://quittio.dev/llms.txt)

[API reference](https://quittio.dev/docs/api) / [Quittio](https://quittio.dev/docs/api/Quittio) \\ [Core](https://quittio.dev/docs/api/Quittio/Core) \\ [Pdf](https://quittio.dev/docs/api/Quittio/Core/Pdf)

# RemoteImageFetcher

final readonly class in quittio/core

`Quittio\Core\Pdf\RemoteImageFetcher` · [Source](https://github.com/Quittio/quittio/blob/v0.7.1/packages/core/src/Pdf/RemoteImageFetcher.php#L15)

Downloads remote logos without server-side request forgery: only http and https, only hosts whose every resolved address (IPv4 and IPv6) is publicly routable, the connection pinned to the checked address (no second DNS lookup) and every redirect checked again.

## Methods \#

| Method | Description |
| --- | --- |
| `->__construct()` | |
| `->fetch()` | Content of the image, or null if it cannot be downloaded. |
| `::isPublicAddress()` | Whether the address is publicly routable: no loopback, private, link-local, shared, reserved, documentation or multicast range, also not embedded in an IPv6 address. |

### `__construct()`#

```
public function __construct(
    int $maxBytes = 10 * 1024 * 1024,
    int $timeout = 10,
    int $maxRedirects = 3,
    (Closure(string): list<string>)|null $resolver = null,
    (Closure(string, string, string): (array{status: int, location: ?string, body: string}|null))|null $transport = null,
)
```

| Parameter | Type | Description |
| --- | --- | --- |
| `$maxBytes` | `int` = `10 * 1024 * 1024` | |
| `$timeout` | `int` = `10` | |
| `$maxRedirects` | `int` = `3` | |
| `$resolver` | `(Closure(string): list<string>)\|null` = `null` | host name => IP addresses |
| `$transport` | `(Closure(string, string, string): (array{status: int, location: ?string, body: string}\|null))\|null` = `null` | URL, host, pinned IP => response, null on failure |

### `fetch()`#

```
public function fetch(string $url): ?string
```

Content of the image, or null if it cannot be downloaded.

| Parameter | Type | Description |
| --- | --- | --- |
| `$url` | `string` | |

<dl><dt>Returns</dt>
<dd><code>?string</code></dd>
<dt>Throws</dt>
<dd><code><a href="https://quittio.dev/docs/api/Quittio/Core/Exceptions/ConfigurationException">ConfigurationException</a></code> – for URLs that are not allowed (scheme, non-public address)</dd></dl>

### `isPublicAddress()`#

```
public static function isPublicAddress(string $ip): bool
```

static

Whether the address is publicly routable: no loopback, private, link-local, shared, reserved, documentation or multicast range, also not embedded in an IPv6 address.

| Parameter | Type | Description |
| --- | --- | --- |
| `$ip` | `string` | |

<dl><dt>Returns</dt>
<dd><code>bool</code></dd>
</dl>

```json
{"@context":"https://schema.org","@graph":[{"@id":"https://quittio.dev/en#website","@type":"WebSite","description":"E-invoicing for PHP and Laravel: create, validate, read and archive ZUGFeRD, XRechnung and Peppol invoices.","inLanguage":"en","name":"Quittio","url":"https://quittio.dev/en","publisher":{"@id":"https://quittio.dev/#identity"},"translationOfWork":{"@id":"https://quittio.dev/#website"}},{"@id":"https://quittio.dev/en/docs/api/Quittio/Core/Pdf/RemoteImageFetcher#webpage","@type":"WebPage","description":"Downloads remote logos without server-side request forgery: only http and https, only hosts whose every resolved address (IPv4 and IPv6) is publicly routable, the connection pinned to the checked address (no second DNS lookup) and every redirect checked again.","name":"RemoteImageFetcher – API reference","url":"https://quittio.dev/en/docs/api/Quittio/Core/Pdf/RemoteImageFetcher","isPartOf":{"@id":"https://quittio.dev/en#website"},"potentialAction":[{"@type":"ReadAction","target":["https://quittio.dev/en/docs/api/Quittio/Core/Pdf/RemoteImageFetcher"]}],"primaryImageOfPage":{"@id":"https://quittio.dev/#logo"}},{"@id":"https://quittio.dev/#identity","@type":"Organization","description":"Open-Source-Bibliothek für E-Rechnungen in PHP und Laravel (ZUGFeRD, XRechnung, Peppol) und Quittio Managed.","email":"kontakt@niklasforst.de","legalName":"Niklas Forst – Softwareentwicklung","name":"Quittio","url":"https://quittio.dev","founder":{"@type":"Person","name":"Niklas Forst","url":"https://quittio.dev/ueber"},"logo":{"@id":"https://quittio.dev/#logo"},"sameAs":["https://github.com/Quittio/quittio","https://packagist.org/packages/quittio/quittio"]},{"@id":"https://quittio.dev/#logo","@type":"ImageObject","caption":"Quittio","contentUrl":"https://quittio.dev/logo.png","inLanguage":"en","url":"https://quittio.dev/logo.png"}]}
```