> ## Documentation Index
> Fetch the complete documentation index at: https://developer.box.com/llms.txt
> Use this file to discover all available pages before exploring further.

# サムネイルレプリゼンテーションの取得

export const MultiRelatedLinks = ({sections = []}) => {
  if (!sections || sections.length === 0) {
    return null;
  }
  return <div className="space-y-8">
      {sections.map((section, index) => <RelatedLinks key={index} title={section.title} items={section.items} />)}
    </div>;
};

export const RelatedLinks = ({title, items = []}) => {
  const getBadgeClass = badge => {
    if (!badge) return "badge-default";
    const badgeType = badge.toLowerCase().replace(/\s+/g, "-");
    return `badge-${badge === "ガイド" ? "guide" : badgeType}`;
  };
  if (!items || items.length === 0) {
    return null;
  }
  return <div className="my-8">
      {}
      <h3 className="text-sm font-bold uppercase tracking-wider mb-4">{title}</h3>

      {}
      <div className="flex flex-col gap-3">
        {items.map((item, index) => <a key={index} href={item.href} className="py-2 px-3 rounded related_link hover:bg-[#f2f2f2] dark:hover:bg-[#111827] flex items-center gap-3 group no-underline hover:no-underline border-b-0">
            {}
            <span className={`px-2 py-1 rounded-full text-xs font-semibold uppercase tracking-wide flex-shrink-0 ${getBadgeClass(item.badge)}`}>
              {item.badge}
            </span>

            {}
            <span className="text-base">{item.label}</span>
          </a>)}
      </div>
    </div>;
};

export const Link = ({href, children, className, ...props}) => {
  const localizedHref = localizeLink(href);
  return <a href={localizedHref} className={className} {...props}>
      {children}
    </a>;
};

<RelatedLinks
  title="必須のガイド"
  items={[
{ label: translate("List All Representations for File"), href: "/guides/representations/list-all-representations", badge: "GUIDE" },
{ label: translate("Request Desired Representation"), href: "/guides/representations/request-a-representation", badge: "GUIDE" },
{ label: translate("Download File Representation"), href: "/guides/representations/download-a-representation", badge: "GUIDE" }
]}
/>

サムネイルとは小さい画像のことで、アプリケーション内でファイルのレプリゼンテーションとして使用できる`.png`または`.jpg`で表されます。たとえば、ファイルをダウンロードまたはプレビューするリンクのプレースホルダとして使用されます。

`1024x1024`および`2048x2048`のPNGを除くすべてのサムネイルレプリゼンテーションは、元のファイルをBoxにアップロードしたときに生成されます。

<Warning>
  ファイルのサムネイルを取得する方法として、<Link href="/guides/representations/thumbnail">サムネイルAPI</Link>の使用は非推奨になりました。
</Warning>

## 手順

サムネイルレプリゼンテーションを取得するには、以下の手順に従います。

* <Link href="/guides/representations/list-all-representations">すべてのレプリゼンテーションのリストを取得する</Link>
* `[jpg?dimensions=32x32]`のように目的のサムネイル形式とサイズを表す`x-rep-hints`ヘッダーを渡して、<Link href="/guides/representations/request-a-representation">サムネイルをリクエストする</Link>。
* `url_template`を呼び出して<Link href="/guides/representations/download-a-representation">サムネイルをダウンロード</Link>する。その際、`{+asset_path}`を空の文字列に置き換えます。

<Warning>
  場合によっては、サムネイルを直接作成できないこともあります。代わりに、APIから`location`レスポンスヘッダーで`HTTP 202`が返されます。この場所は、サムネイルの生成中に使用できる一時的な画像のためのものです。
</Warning>

このエンドポイントを再試行するまでの推定秒数を示すretry-afterレスポンスヘッダーも返されます。

## 例

`x-rep-hints`ヘッダーの値の例を以下に示します。

| `x-rep-hints: [jpg?dimensions=32x32]` |
| ------------------------------------- |
| `32x32`のJPEGサムネイルを返します。               |

| `x-rep-hints: [jpg?dimensions=32x32][jpg?dimensions=1024x1024]` |
| --------------------------------------------------------------- |
| `32x32`および`1024x1024`のJPEGサムネイルを返します。                           |

| `x-rep-hints: [jpg?dimensions=32x32][png?dimensions=2048x2048]` |
| --------------------------------------------------------------- |
| `32x32`のJPEGサムネイルおよび`2048x2048`のPNGサムネイルを返します。                  |

| `x-rep-hints: [jpg?dimensions=2048x2048,png?dimensions=2048x2048]`                                        |
| --------------------------------------------------------------------------------------------------------- |
| `2048x2048`のJPEGサムネイルおよび`2048x2048`のPNGサムネイルを返し、使用可能な最初のレプリゼンテーションを返します。どちらも使用可能でない場合は、レプリゼンテーションは返されません。 |

## サポートされているファイルサイズ

以下のサムネイルの形式とサイズが使用可能です。

| ファイルの種類 | サイズ                                                                |
| ------- | ------------------------------------------------------------------ |
| JPG     | `32x32`, `94x94`, `160x160`, `320x320`, `1024x1024`, `2048x2048`\* |
| PNG     | `1024x1024`\*, `2048x2048`\*                                       |

`*`が付いているサイズには、いくつかの制限があります。

## ファイルサイズの制限

### `2048x2048`のJPEG

`2048x2048`サイズのJPEGを使用できるのは、元のファイルがJPEGの場合のみです。このサイズを使用する場合は、PNGか、PNGとJPEGの両方をリクエストすることをお勧めします。

### 動画ファイル

`2048x2048`のJPEG、`2048x20148`のPNG、および`1024x1024`のPNGのレプリゼンテーションは、動画ファイルでは使用できません。

### 元のファイルサイズ

サムネイルは拡大されません。Boxにアップロードされたファイルの元のファイルサイズがレプリゼンテーションのサイズより小さい場合は、作成されるサムネイルのサイズの上限は元のファイルのサイズになります。

## サポートされているファイルの種類

現時点でサポートされているファイルの種類は以下のとおりです。

| ファイルの種類 | ファイル拡張子                                                                                                                                                         |
| ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ドキュメント  | `doc`, `docx`, `gdoc`, `gsheet`, `gslide`, `gslides`, `odp`, `ods`, `odt`, `pdf`, `ppt`, `pptx`, `rtf`, `wpd`, `xls`, `xlsm`, `xlsx`, `key`, `pages`, `numbers` |
| 画像      | `ai`, `bmp`, `dcm`, `dicm`, `eps`, `gif`, `idml`, `indd`, `indt`, `inx`, `jpeg`, `jpg`, `png`, `ps`, `psd`, `svg`, `svs`, `tif`, `tiff`, `tga`                  |
| オーディオ   | `aac`, `aifc`, `aiff`, `amr`, `au`, `flac`, `m4a`, `mp3`, `ogg`, `ra`, `wav`, `wma`                                                                             |
| 動画      | `3g2`, `3gp`, `avi`, `m2v`, `m2ts`, `m4v`, `mkv`, `mov`, `mp4`, `mpeg`, `mpg`, `ogg`, `mts`, `qt`, `wmv`                                                        |

<Warning>
  ファイルの種類が**ドキュメント**の場合、返されるレプリゼンテーションはプレースホルダアイコンとなり、実際のサムネイルではありません。
</Warning>

<RelatedLinks
  title="関連するAPI"
  items={[
{ label: translate("Get file information"), href: "/reference/get-files-id", badge: "GET" }
]}
/>

<RelatedLinks
  title="関連するガイド"
  items={[
{ label: translate("Get PDF Representation"), href: "/guides/representations/pdf", badge: "GUIDE" },
{ label: translate("Supported File Types"), href: "/guides/representations/supported-file-types", badge: "GUIDE" }
]}
/>
