当サイト、Codex 日本語版は今後積極的な更新は行わない予定です。後継となる新ユーザーマニュアルは、https://ja.wordpress.org/support/ にあります。
万が一、当サイトで重大な問題を発見した際などは、フォーラムWordSlack #docs チャンネルでお知らせください。</p>

「関数リファレンス/wp read image metadata」の版間の差分

提供: WordPress Codex 日本語版
移動先: 案内検索
(developer.wordpress.org/reference/functions/wp_read_image_metadata から流し込み。)
 
(途中まで翻訳。)
3行目: 3行目:
 
== 説明<span id="Description"></span> ==
 
== 説明<span id="Description"></span> ==
  
Get extended image metadata, exif or iptc as available.
+
画像ファイルの拡張メタデータ(付加されている EXIF または IPTC)を取得します。
  
Retrieves the EXIF metadata aperture, credit, camera, caption, copyright, iso created_timestamp, focal_length, shutter_speed, and title.
+
EXIF メタデータは aperture, credit, camera, caption, copyright, iso created_timestamp, focal_length, shutter_speed, および title を取得します。
  
The IPTC metadata that is retrieved is APP13, credit, byline, created date and time, caption, copyright, and title. Also includes FNumber, Model, DateTimeDigitized, FocalLength, ISOSpeedRatings, and ExposureTime.
+
IPTC メタデータは APP13, credit, byline, created date and time, caption, copyright, および title を取得します。さらに FNumber, Model, DateTimeDigitized, FocalLength, ISOSpeedRatings, および ExposureTime も含まれます。
  
 
== 使い方<span id="Usage"></span> ==
 
== 使い方<span id="Usage"></span> ==
  
  <?php wp_read_image_metadata( string ); ?>
+
  <?php wp_read_image_metadata( $file ); ?>
  
 
== パラメータ<span id="Parameters"></span> ==
 
== パラメータ<span id="Parameters"></span> ==
  
{{Parameter|$file|string||required}}
+
{{Parameter|$file|string|画像ファイルの絶対パス。|必須}}
  
 
== 戻り値<span id="Return_Values"></span> ==
 
== 戻り値<span id="Return_Values"></span> ==
  
{{Return||bool&#124;array|False on failure. Image metadata array on success.}}
+
{{Return||真偽値&#124;配列|失敗すると false を返します。成功すると画像のメタデータの配列を返します。}}
  
The elements returned in the array are:
+
返される配列の要素は次のとおりです:
  
["aperture"]  
+
; <tt>["aperture"]</tt> : (string) Set to the EXIF FNumber field.
(string) Set to the EXIF FNumber field.
+
  
["credit"]  
+
; <tt>["credit"]</tt> : (string) Set to the first non-empty value found by looking through the following fields:
(string) Set to the first non-empty value found by looking through the following fields:
+
:# IPTC Credit field (2#110)
 +
:# IPTC Creator field (2#080)
 +
:# EXIF Artist field
 +
:# EXIF Author field
  
1. IPTC Credit field (2#110)
+
; <tt>["camera"]</tt> : (string) Set to the EXIF Model field.
2. IPTC Creator field (2#080)
+
3. EXIF Artist field
+
4. EXIF Author field
+
  
["camera"]  
+
; <tt>["caption"]</tt> : (string) Set to a non-empty value of one of the following fields (see source code for the precise logic involved):
(string) Set to the EXIF Model field.
+
:# IPTC Description field (2#120)
 +
:# EXIF UserComment field if [“title”] is unset AND EXIF:ImageDescription is less than 80 characters
 +
:# EXIF ImageDescription field if [“title”] is set OR EXIF:ImageDescription is more than 80 characters
 +
:# EXIF Comments field if [“title”] does not equal EXIF:Comments
  
["caption"]  
+
; <tt>["created_timestamp"]</tt> : (string) Set to the first non-empty value found by looking through the following fields:
(string) Set to a non-empty value of one of the following fields (see source code for the precise logic involved):
+
:# EXIF field DateTimeDigitized
 +
:# IPTC Date and Time fields (2#055 and 2#060)
  
1. IPTC Description field (2#120)
+
; <tt>["copyright"]</tt> : (string) Set to the first non-empty value found by looking through the following fields:
2. EXIF UserComment field if [“title”] is unset AND EXIF:ImageDescription is less than 80 characters
+
:# IPTC Copyright field (2#116)
3. EXIF ImageDescription field if [“title”] is set OR EXIF:ImageDescription is more than 80 characters
+
:# EXIF Copyright field
4. EXIF Comments field if [“title”] does not equal EXIF:Comments
+
  
["created_timestamp"]  
+
; <tt>["focal_length"]</tt> : (string) Set to the EXIF FocalLength field.
(string) Set to the first non-empty value found by looking through the following fields:
+
  
1. EXIF field DateTimeDigitized
+
; <tt>["iso"]</tt> : (string) Set to the EXIF ISOSpeedRatings field.
2. IPTC Date and Time fields (2#055 and 2#060)
+
  
["copyright"]  
+
; <tt>["shutter_speed"]</tt> : (string) Set to the EXIF ExposureTime field.
(string) Set to the first non-empty value found by looking through the following fields:
+
  
1. IPTC Copyright field (2#116)
+
; <tt>["title"]</tt> : (string) Set to the first non-empty value found by looking through the following fields:
2. EXIF Copyright field
+
:# IPTC Headline field (2#105)
 +
:# IPTC Title field (2#005)
 +
:# IPTC Description field (2#120) but only if less than 80 characters
 +
:# EXIF Title field
 +
:# EXIF ImageDescription field but only if less than 80 characters
  
["focal_length"]
+
'''参考:''' The (2#nnn) value shown after each IPTC field (above) is the key of the array returned by PHP’s iptcparse function for that particular IPTC field.
(string) Set to the EXIF FocalLength field.
+
 
+
["iso"]
+
(string) Set to the EXIF ISOSpeedRatings field.
+
 
+
["shutter_speed"]
+
(string) Set to the EXIF ExposureTime field.
+
 
+
["title"]
+
(string) Set to the first non-empty value found by looking through the following fields:
+
 
+
1. IPTC Headline field (2#105)
+
2. IPTC Title field (2#005)
+
3. IPTC Description field (2#120) but only if less than 80 characters
+
4. EXIF Title field
+
5. EXIF ImageDescription field but only if less than 80 characters
+
 
+
The (2#nnn) value shown after each IPTC field (above) is the key of the array returned by PHP’s iptcparse function for that particular IPTC field.
+
  
 
== 用例<span id="Examples"></span> ==
 
== 用例<span id="Examples"></span> ==
81行目: 66行目:
 
== 参考<span id="Notes"></span> ==
 
== 参考<span id="Notes"></span> ==
  
When you receive error upon calling this function
+
この関数を呼び出して次のようなエラーが発生した場合は:
  
 
  PHP Fatal error: Uncaught Error: Call to undefined function wp_read_image_metadata() ...
 
  PHP Fatal error: Uncaught Error: Call to undefined function wp_read_image_metadata() ...
  
Make sure to include the wp-admin/includes/image.php file
+
ファイル <tt>wp-admin/includes/image.php</tt> をインクルードしてください:
  
<pre>
+
<pre><?php
 
require_once ABSPATH . '/wp-admin/includes/image.php';
 
require_once ABSPATH . '/wp-admin/includes/image.php';
 
   
 
   
93行目: 78行目:
 
   
 
   
 
wp_read_image_metadata( $path );
 
wp_read_image_metadata( $path );
</pre>
+
?></pre>
  
 
== 変更履歴<span id="Change_Log"></span> ==
 
== 変更履歴<span id="Change_Log"></span> ==
  
2.5.0 : Introduced.
+
新規導入 : [[Version 2.5|2.5]]
  
 
== ソースファイル<span id="Source_File"></span> ==
 
== ソースファイル<span id="Source_File"></span> ==

2018年5月4日 (金) 17:50時点における版

このページ「関数リファレンス/wp read image metadata」は未翻訳です。和訳や日本語情報を加筆してくださる協力者を求めています

説明

画像ファイルの拡張メタデータ(付加されている EXIF または IPTC)を取得します。

EXIF メタデータは aperture, credit, camera, caption, copyright, iso created_timestamp, focal_length, shutter_speed, および title を取得します。

IPTC メタデータは APP13, credit, byline, created date and time, caption, copyright, および title を取得します。さらに FNumber, Model, DateTimeDigitized, FocalLength, ISOSpeedRatings, および ExposureTime も含まれます。

使い方

<?php wp_read_image_metadata( $file ); ?>

パラメータ

$file
string) (必須) 画像ファイルの絶対パス。
初期値: なし

戻り値

(真偽値|配列) 
失敗すると false を返します。成功すると画像のメタデータの配列を返します。

返される配列の要素は次のとおりです:

["aperture"] 
(string) Set to the EXIF FNumber field.
["credit"] 
(string) Set to the first non-empty value found by looking through the following fields:
  1. IPTC Credit field (2#110)
  2. IPTC Creator field (2#080)
  3. EXIF Artist field
  4. EXIF Author field
["camera"] 
(string) Set to the EXIF Model field.
["caption"] 
(string) Set to a non-empty value of one of the following fields (see source code for the precise logic involved):
  1. IPTC Description field (2#120)
  2. EXIF UserComment field if [“title”] is unset AND EXIF:ImageDescription is less than 80 characters
  3. EXIF ImageDescription field if [“title”] is set OR EXIF:ImageDescription is more than 80 characters
  4. EXIF Comments field if [“title”] does not equal EXIF:Comments
["created_timestamp"] 
(string) Set to the first non-empty value found by looking through the following fields:
  1. EXIF field DateTimeDigitized
  2. IPTC Date and Time fields (2#055 and 2#060)
["copyright"] 
(string) Set to the first non-empty value found by looking through the following fields:
  1. IPTC Copyright field (2#116)
  2. EXIF Copyright field
["focal_length"] 
(string) Set to the EXIF FocalLength field.
["iso"] 
(string) Set to the EXIF ISOSpeedRatings field.
["shutter_speed"] 
(string) Set to the EXIF ExposureTime field.
["title"] 
(string) Set to the first non-empty value found by looking through the following fields:
  1. IPTC Headline field (2#105)
  2. IPTC Title field (2#005)
  3. IPTC Description field (2#120) but only if less than 80 characters
  4. EXIF Title field
  5. EXIF ImageDescription field but only if less than 80 characters

参考: The (2#nnn) value shown after each IPTC field (above) is the key of the array returned by PHP’s iptcparse function for that particular IPTC field.

用例

参考

この関数を呼び出して次のようなエラーが発生した場合は:

PHP Fatal error: Uncaught Error: Call to undefined function wp_read_image_metadata() ...

ファイル wp-admin/includes/image.php をインクルードしてください:

<?php
require_once ABSPATH . '/wp-admin/includes/image.php';
 
$path = '/path/to/file.jpg';
 
wp_read_image_metadata( $path );
?>

変更履歴

新規導入 : 2.5

ソースファイル

wp_read_image_metadata()wp-admin/includes/image.php にあります。

関連項目

関数リファレンステンプレートタグ目次もご覧ください。


最新英語版: Reference / Functions / wp_read_image_metadata()