---
title: "RemoteImageFetcher – API-Referenz · 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/docs/api/Quittio/Core/Pdf/RemoteImageFetcher"
locale: de
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-de.jpg"
  "og:image:alt": "Quittio: E-Rechnungen für PHP und Laravel. Rechtssicher, validiert, archiviert, mit geprüfter Beispielrechnung."
  "og:image:height": "630"
  "og:image:type": image/jpeg
  "og:image:width": "1200"
  "og:title": "RemoteImageFetcher – API-Referenz · Quittio"
  "twitter:image": "https://quittio.dev/og/quittio-de.jpg"
  "twitter:image:alt": "Quittio: E-Rechnungen für PHP und Laravel. Rechtssicher, validiert, archiviert, mit geprüfter Beispielrechnung."
---

> 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/#website","@type":"WebSite","description":"E-Rechnungen für PHP und Laravel: ZUGFeRD, XRechnung und Peppol erstellen, prüfen, lesen und archivieren.","inLanguage":"de-DE","name":"Quittio","url":"https://quittio.dev/","publisher":{"@id":"https://quittio.dev/#identity"},"workTranslation":{"@id":"https://quittio.dev/en#website"}},{"@id":"https://quittio.dev/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-Referenz","url":"https://quittio.dev/docs/api/Quittio/Core/Pdf/RemoteImageFetcher","isPartOf":{"@id":"https://quittio.dev/#website"},"potentialAction":[{"@type":"ReadAction","target":["https://quittio.dev/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":"de-DE","url":"https://quittio.dev/logo.png"}]}
```