<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>なべし  |  なべしブログ</title>
	<atom:link href="https://nabeshiblog.com/author/b7702e3d617b781104170bd6c5567fb137519d17/feed/" rel="self" type="application/rss+xml" />
	<link>https://nabeshiblog.com</link>
	<description></description>
	<lastBuildDate>Fri, 29 Apr 2022 02:37:50 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://nabeshiblog.com/wp-content/uploads/2022/04/cropped-アイコン-32x32.png</url>
	<title>なべし  |  なべしブログ</title>
	<link>https://nabeshiblog.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>HTML5プロフェッショナル認定試験 レベル1 レベル2 を一発合格した勉強法とは</title>
		<link>https://nabeshiblog.com/html5professional/</link>
		
		<dc:creator><![CDATA[なべし]]></dc:creator>
		<pubDate>Fri, 29 Apr 2022 02:37:50 +0000</pubDate>
				<category><![CDATA[資格]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[javascript]]></category>
		<guid isPermaLink="false">https://nabeshiblog.com/?p=480</guid>

					<description><![CDATA[今回はHTML5プロフェッショナル認定試験に一発合格するにあたって、 どのような勉強をしたのか どの書籍やサイトを参考にしたのか を紹介していきます！ HTML5プロフェッショナル認定試験とは HTML5プロフェッショナ [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>今回はHTML5プロフェッショナル認定試験に一発合格するにあたって、</p>



<ul class="wp-block-list"><li>どのような勉強をしたのか</li><li>どの書籍やサイトを参考にしたのか</li></ul>



<p>を紹介していきます！</p>



<h2 class="wp-block-heading"><span id="toc1">HTML5プロフェッショナル認定試験とは</span></h2>



<blockquote class="wp-block-quote is-layout-flow wp-block-quote-is-layout-flow"><p>HTML5プロフェッショナル認定とは、HTML5、CSS3、JavaScriptなど最新のマークアップに関する技術力と知識を、公平かつ厳正に、中立的な立場で認定する認定制度です。</p><cite>https://html5exam.jp/outline/</cite></blockquote>



<p>簡単にいうと、フロントエンドに関する知識を問われる試験ということです。</p>



<p>ここで重要なのは、HTML5プロフェッショナル認定試験はHTMLの資格ではなく、HTMLに関連する技術を問う試験なのです！</p>



<p>なので、この資格を持っているということは、HTML5に関連する知識も持ち合わせているということの証明にもなるのです！！</p>



<h3 class="wp-block-heading"><span id="toc2">レベル1とレベル2の違い</span></h3>



<p>レベル1は、HTMLとCSSの文法からニッチなタグや擬似要素や擬似クラスについて問われます。<br>一部、canvasタグやvideoタグの問題でJavaScriptの知識が少しだけ必要になりますが、JavaScriptの文法などは問われません。<br>canvasタグでできることは？videoタグでできることは？といった問題です。</p>



<p>レベル2は、JavaScriptの文法からDOM操作やAPIについて問われます。<br>こちらもレベル1同様に知識を問われる問題も出題されるのですが、出題されるJavaScriptのコードを読んで、処理の結果がどうなるかを問う問題が多いです。</p>



<p>レベル1、レベル2という風に試験が分かれていますが、受験する順番はどちらが先でも構いません。<br>先にレベル2に合格したからといって、その合格が有効にならないということはありません。</p>



<h2 class="wp-block-heading"><span id="toc3">レベル1</span></h2>



<h3 class="wp-block-heading"><span id="toc4">使用するサイト・書籍</span></h3>



<p><a rel="noopener" href="https://mondai.ping-t.com" data-type="URL" data-id="https://mondai.ping-t.com" target="_blank">Ping-t</a>のプレミアムプラン 2400円(税込)<br>Ping-tはIT系の資格を目指す人の学習サイトです。<br>無料の問題も公開されていますが、HTML5プロフェッショナル認定試験レベル1は有料コンテンツになっています。</p>



<h3 class="wp-block-heading"><span id="toc5">出題範囲</span></h3>



<ol>
  <li>
    <strong>Webの基礎知識</strong>
    <ol>
      <li>HTTP, HTTPSプロトコル（重要度：8）</li>
      <li>HTMLの書式（重要度：9）</li>
      <li>Web関連技術の概要（重要度：6）</li>
    </ol>
  </li>
  <li>
    <strong>CSS</strong>
    <ol>
      <li>スタイルシートの基本（重要度：7）</li>
      <li>CSSデザイン（重要度：9）</li>
      <li>カスケード（優先順位）（重要度：2</li>
    </ol>
  </li>
  <li>
    <strong>要素</strong>
    <ol>
      <li>要素と属性の意味（セマンティクス）（重要度：10）</li>
      <li>メディア要素（重要度：6）</li>
      <li>インタラクティブ要素（重要度：7）</li>
    </ol>
  </li>
  <li>
    <strong>レスポンシブWebデザイン</strong>
    <ol>
      <li>マルチデバイス対応（重要度：7）</li>
      <li>メディアクエリ（重要度：5）</li>
    </ol>
  </li>
  <li>
    <strong>APIの基礎知識</strong>
    <ol>
      <li>マルチメディア・グラフィックス系API概要（重要度：5）</li>
      <li>デバイスアクセス系API概要（重要度：4）</li>
      <li>オフライン・ストレージ系API概要（重要度：4）</li>
      <li>通信系API概要（重要度：3）</li>
    </ol>
  </li>
</ol>



<h3 class="wp-block-heading"><span id="toc6">勉強法</span></h3>



<p>まずはPing-tのサイトにアクセスして<a rel="noopener" href="https://ping-t.com/register.php" data-type="URL" data-id="https://ping-t.com/register.php" target="_blank">会員登録</a>を行ってください。</p>



<p>会員登録ができたら<a rel="noopener" href="https://ping-t.com/modules/premium_app/index.php?content_id=1" data-type="URL" data-id="https://ping-t.com/modules/premium_app/index.php?content_id=1" target="_blank">Ping-tのプレミアムプラン</a>に申し込みます。<br>プレミアムプランに申し込んでから<strong>1ヶ月間</strong>問題集を利用できます。</p>



<p>学習順は、<strong>最初にAPIの基礎知識を学習してください</strong>。<br>それ以降の順はなんでも大丈夫です。<br>Ping-tの合格者の声を見ると、<span class="marker-under">APIの基礎知識の学習時間が足りなかった</span>や<span class="marker-under">APIの基礎知識をもう少し勉強しておけばよかった</span>などがあります。<br><strong>点数を稼げる項目</strong>なので他のどこよりも徹底的に勉強してください。</p>



<p>Ping-tでは項目ごとに出題数を指定することができるのですが、<br><strong>1週目は出題数を3問や5問などの少ない数に設定しておきましょう。</strong><br>3~5問に設定する理由は、Ping-tで公開されている問題は過去問ではないため、問題をこなしたからといって合格できるわけではないからです。<strong><br></strong>回答し終わったら、解答の解説に書かれている内容は暗記するくらいの気持ちで熟読してください。<br>解説は他の問題を解くときに役立つ内容が書かれているので、これを繰り返すだけで十分合格ラインに立てます。</p>



<p>上記内容を意識してゆっくり学習したとしても1~1.5ヶ月で合格できます。</p>



<p>勉強する際にノートをとってもいいのですが、時間がかかるのであまり効率的ではないです。<br>無料で使える暗記カードアプリがあるので有効活用しましょう。</p>



<div class="wp-block-cocoon-blocks-blogcard blogcard-type bct-none">

<a href="https://nabeshiblog.com/ankilot/" title="手軽に暗記 Ankilot" class="blogcard-wrap internal-blogcard-wrap a-wrap cf"><div class="blogcard internal-blogcard ib-left cf"><div class="blogcard-label internal-blogcard-label"><span class="fa"></span></div><figure class="blogcard-thumbnail internal-blogcard-thumbnail"><img decoding="async" width="160" height="99" src="https://nabeshiblog.com/wp-content/uploads/2022/04/Ankilot-160x99.png" class="blogcard-thumb-image internal-blogcard-thumb-image wp-post-image" alt="" srcset="https://nabeshiblog.com/wp-content/uploads/2022/04/Ankilot-160x99.png 160w, https://nabeshiblog.com/wp-content/uploads/2022/04/Ankilot-120x74.png 120w, https://nabeshiblog.com/wp-content/uploads/2022/04/Ankilot-320x198.png 320w" sizes="(max-width: 160px) 100vw, 160px" /></figure><div class="blogcard-content internal-blogcard-content"><div class="blogcard-title internal-blogcard-title">手軽に暗記 Ankilot</div><div class="blogcard-snippet internal-blogcard-snippet">資格や英語の勉強で暗記するために単語カードや単語帳を作ったことありませんか？単語カードに長い文章を書くと文字が小さくなって後々読み返しづらくなってしまったり、単語帳に暗記したい用語をまとめると用語の順番シャッフルできなくてもどかしかったりという経験が少なからずあると思います。Ankilotはこの悩みを解決してくれるだけでなく、PCとスマホの同期、読み上げ機能もあります</div></div><div class="blogcard-footer internal-blogcard-footer cf"><div class="blogcard-site internal-blogcard-site"><div class="blogcard-favicon internal-blogcard-favicon"><img decoding="async" src="https://www.google.com/s2/favicons?domain=https://nabeshiblog.com" alt="" class="blogcard-favicon-image internal-blogcard-favicon-image" width="16" height="16" /></div><div class="blogcard-domain internal-blogcard-domain">nabeshiblog.com</div></div><div class="blogcard-date internal-blogcard-date"><div class="blogcard-post-date internal-blogcard-post-date">2021.09.15</div></div></div></div></a>
</div>



<p>レベル1については最後になりますが、参考書を買う必要はないです。<br>現在(2022/4/28)出版されているレベル1の書籍は2冊ありますが、どちらもPing-tのプレミアムプランより高いです。</p>



<!-- START MoshimoAffiliateEasyLink -->
<script type="text/javascript">
(function(b,c,f,g,a,d,e){b.MoshimoAffiliateObject=a;
b[a]=b[a]||function(){arguments.currentScript=c.currentScript
||c.scripts[c.scripts.length-2];(b[a].q=b[a].q||[]).push(arguments)};
c.getElementById(a)||(d=c.createElement(f),d.src=g,
d.id=a,e=c.getElementsByTagName("body")[0],e.appendChild(d))})
(window,document,"script","//dn.msmstatic.com/site/cardlink/bundle.js?20220329","msmaflink");
msmaflink({"n":"【新品】【本】HTML5プロフェッショナル認定試験レベル1スピードマスター問題集 抜山雄一\/著 七條怜子\/著 松井正徳\/著 結城陽平\/著","b":"","t":"","d":"https:\/\/thumbnail.image.rakuten.co.jp","c_p":"","p":["\/@0_mall\/dorama\/cabinet\/bkimg\/2018\/008\/33734149.jpg"],"u":{"u":"https:\/\/item.rakuten.co.jp\/dorama\/n33734149\/","t":"rakuten","r_v":""},"v":"2.1","b_l":[{"id":2,"u_tx":"Amazonで見る","u_bc":"#f79256","u_url":"https:\/\/amzn.to\/3Knfybf","a_id":0,"p_id":0,"pl_id":0,"pc_id":0,"s_n":"custom_2","u_so":1},{"id":1,"u_tx":"楽天市場で見る","u_bc":"#f76956","u_url":"https:\/\/item.rakuten.co.jp\/dorama\/n33734149\/","a_id":3074078,"p_id":54,"pl_id":27059,"pc_id":54,"s_n":"rakuten","u_so":2}],"eid":"mH0ap","s":"s"});
</script>
<div id="msmaflink-mH0ap">リンク</div>
<!-- MoshimoAffiliateEasyLink END -->



<p><strong>学習期間が1ヶ月以上</strong>かつ<strong>書籍購入予算が3,000円くらい</strong>の場合はこちらで学習して見てもいいかもしれません。<br>個人的には<span class="marker-under"><strong>API系の問題が充実している</strong></span>ように感じました。</p>



<p>時間がある方は<a rel="noopener" href="https://html5exam.jp/measures/sample.html" data-type="URL" data-id="https://html5exam.jp/measures/sample.html" target="_blank">公式のサンプル問題</a>にも取り組みましょう。<br>このサンプル問題は非常に難易度が高いです。<br>その割に実際に出題される問題は1問か2問くらいでコスパが悪いので本当に時間がある方だけ取り組むようにしてください。</p>



<h2 class="wp-block-heading"><span id="toc7">レベル2の勉強法</span></h2>



<h3 class="wp-block-heading"><span id="toc8">使用するサイト・書籍</span></h3>



<!-- START MoshimoAffiliateEasyLink -->
<script type="text/javascript">
(function(b,c,f,g,a,d,e){b.MoshimoAffiliateObject=a;
b[a]=b[a]||function(){arguments.currentScript=c.currentScript
||c.scripts[c.scripts.length-2];(b[a].q=b[a].q||[]).push(arguments)};
c.getElementById(a)||(d=c.createElement(f),d.src=g,
d.id=a,e=c.getElementsByTagName("body")[0],e.appendChild(d))})
(window,document,"script","//dn.msmstatic.com/site/cardlink/bundle.js?20220329","msmaflink");
msmaflink({"n":"HTML5プロフェッショナル認定試験レベル2スピードマスター問題集[本\/雑誌] (HTML教科書) \/ 抜山雄一\/著 七條怜子\/著 結城陽平\/著","b":"","t":"","d":"https:\/\/thumbnail.image.rakuten.co.jp","c_p":"","p":["\/@0_mall\/neowing-r\/cabinet\/item_img_1265\/neobk-2308904.jpg"],"u":{"u":"https:\/\/item.rakuten.co.jp\/neowing-r\/neobk-2308904\/","t":"rakuten","r_v":""},"v":"2.1","b_l":[{"id":2,"u_tx":"Amazonで見る","u_bc":"#f79256","u_url":"https:\/\/amzn.to\/3vmEhIt","a_id":0,"p_id":0,"pl_id":0,"pc_id":0,"s_n":"custom_2","u_so":1},{"id":1,"u_tx":"楽天市場で見る","u_bc":"#f76956","u_url":"https:\/\/item.rakuten.co.jp\/neowing-r\/neobk-2308904\/","a_id":3074078,"p_id":54,"pl_id":27059,"pc_id":54,"s_n":"rakuten","u_so":2}],"eid":"VJ7nF","s":"s"});
</script>
<div id="msmaflink-VJ7nF">リンク</div>
<!-- MoshimoAffiliateEasyLink END -->



<p>HTML5プロフェッショナル認定試験レベル2スピードマスター問題集 ¥3,740(税込)</p>



<p><a rel="noopener" href="https://jsprimer.net/" data-type="URL" data-id="https://jsprimer.net/" target="_blank">JavaScript Primer</a></p>



<h3 class="wp-block-heading"><span id="toc9">出題範囲</span></h3>



<ol>
  <li>
    <strong>JavaScript</strong>
    <ol>
      <li>JavaScript文法(重要度：10)</li>
      <li class="has-red-color"><strong>ES6（ECMAScript2015）以降の新機能(重要度：8)</strong></li>
    </ol>
  </li>
  <li>
    <strong>WebブラウザにおけるJavaScript API</strong>
    <ol>
      <li>イベント(重要度：8)</li>
      <li>ドキュメントオブジェクト／DOM(重要度：6)</li>
      <li>ウィンドウオブジェクト(重要度：8)</li>
      <li>Selectors API(重要度：7)</li>
      <li>History API(重要度：7)</li>
      <li>テスト・デバッグ(重要度：6)</li>
    </ol>
  </li>
  <li>
    <strong>グラフィックス・アニメーション</strong>
    <ol>
      <li>Canvas(2D)(重要度：8)</li>
      <li>SVG(重要度：2)</li>
      <li>Timing control for script-based animations(重要度：2)</li>
    </ol>
  </li>
  <li>
    <strong>マルチメディア</strong>
    <ol>
      <li>メディア要素のAPI(重要度：5)</li>
    </ol>
  </li>
  <li>
    <strong>ストレージ</strong>
    <ol>
      <li>Web Storage(重要度：7)</li>
      <li>Indexed Database API(重要度：5)</li>
      <li>File API(重要度：5)</li>
      <li>バイナリーデータ(重要度：4)</li>
    </ol>
  </li>
  <li>
    <strong>通信</strong>
    <ol>
      <li>Web Socket(重要度：5)</li>
      <li>XMLHttpRequest(重要度：5)</li>
      <li>Server-Sent Events(重要度：1)</li>
    </ol>
  </li>
  <li>
    <strong>デバイスアクセス</strong>
    <ol>
      <li>Geolocation API(重要度：5)</li>
      <li>DeviceOrientation Event(重要度：1)</li>
    </ol>
  </li>
  <li>
    <strong>パフォーマンスとオフライン</strong>
    <ol>
      <li>Web Wokers(重要度：5)</li>
      <li>High Resolution Time(重要度：2)</li>
      <li>オフラインアプリケーションAPI(重要度：3)</li>
      <li>Page Visibility(重要度：2)</li>
      <li>Navigation Timing(重要度：1)</li>
    </ol>
  </li>
  <li>
    <strong>セキュリティモデル</strong>
    <ol>
      <li>クロスオリジン制約とCORS(重要度：4)</li>
      <li>セキュリティモデルとSSLの関係(重要度：4)</li>
    </ol>
  </li>
</ol>




<h3 class="wp-block-heading"><span id="toc10">勉強法</span></h3>



<p>問題集を使って学習を始める前に、まずは出題範囲を確認してください！<br>2021/4/1に出題範囲の改定があり、以下の項目が追加されました。</p>



<p class="has-red-color has-text-color"><strong>ES6（ECMAScript2015）以降の新機能(重要度：8)</strong></p>



<p>この項目は問題集に含まれていないので注意です。</p>



<p>JavaScriptを勉強したことはあるけれど、まだそんなに使ったことがない方は一番最初から勉強していけばOKです。<br>それなりにJavaScriptを使っている方(Web制作レベルでOK)は<strong>5章</strong>から勉強するようにしましょう。</p>



<p>勉強法はレベル1同様に解説をしっかり理解することが一発合格への近道となります。<br>レベル2では「以下のコードを実行したときに正しいものを選べ」というような問題が出題されるため、手を動かして処理の流れを把握しておくことが大事です。<br>レベル1はどちらかというと暗記する項目が多かったですが、レベル2は<strong>処理の流れ</strong>や<strong>処理結果</strong>がどのようなものになるのかを理解しておけば大丈夫です。</p>



<p>書籍の巻末に試験2回分の問題があるので必ず取り組んでください。<br>受験日から1週間前くらいに取り組むのがオススメです。</p>



<p>余裕がある方は<a rel="noopener" href="https://html5exam.jp/measures/sample.html" data-type="URL" data-id="https://html5exam.jp/measures/sample.html" target="_blank">公式のサンプル問題</a>にも取り組んでみてください。</p>



<h2 class="wp-block-heading"><span id="toc11">受験料を安くするには？</span></h2>



<p>受験料はレベル1レベル2共に￥16,500(税込)です。</p>



<p>とても安い金額とはいえません。<br>そこで、少しでも受験料を安くする方法をお伝えします！</p>



<p>安く受験するにはPing-tで受験チケットを購入するだけです。<br>受験チケットの価格が¥ 15,400(税込)なので<strong>1,100円</strong>お得です！<br><a rel="noopener" href="https://ping-t.com/modules/ticket/index.php?content_id=9" data-type="URL" data-id="https://ping-t.com/modules/ticket/index.php?content_id=9" target="_blank">こちら</a>から購入できます！<br>1つのチケットで1つの試験に適用できます。<br>受験チケットを使用するには、試験申し込みの際にチケット番号を入力する箇所があるのでそこに必ず入力してください。</p>



<h2 class="wp-block-heading"><span id="toc12">試験に合格すると。。。</span></h2>



<p>試験合格から約2ヶ月後くらいに合格証明書が送付されます。</p>



<figure class="wp-block-image size-full"><img fetchpriority="high" decoding="async" width="1000" height="384" src="https://nabeshiblog.com/wp-content/uploads/2022/04/html5professional2.jpg" alt="" class="wp-image-512" srcset="https://nabeshiblog.com/wp-content/uploads/2022/04/html5professional2.jpg 1000w, https://nabeshiblog.com/wp-content/uploads/2022/04/html5professional2-300x115.jpg 300w, https://nabeshiblog.com/wp-content/uploads/2022/04/html5professional2-768x295.jpg 768w" sizes="(max-width: 1000px) 100vw, 1000px" /></figure>



<p>レベル1とレベル2の合格証明書を合わせると、HTML5のロゴが完成します。<br>なんだかバイオハザードの重要アイテム見たいですね笑</p>



<p>その他の戦利品です。</p>



<figure class="wp-block-image size-full"><img decoding="async" width="1000" height="831" src="https://nabeshiblog.com/wp-content/uploads/2022/04/html5professional1.jpg" alt="" class="wp-image-513" srcset="https://nabeshiblog.com/wp-content/uploads/2022/04/html5professional1.jpg 1000w, https://nabeshiblog.com/wp-content/uploads/2022/04/html5professional1-300x249.jpg 300w, https://nabeshiblog.com/wp-content/uploads/2022/04/html5professional1-768x638.jpg 768w" sizes="(max-width: 1000px) 100vw, 1000px" /></figure>



<h2 class="wp-block-heading"><span id="toc13">おわりに</span></h2>



<p>今回はHTML5プロフェッショナル認定試験の勉強法について書きましたが、いかがでしたか？</p>



<p>Web制作の実績があまり多くなく、提案をしても返事が来る確率が低いという方は是非この資格をとってみてください！<br>資格を持っているということは実力の証明になるので、クライアントからの信頼も得やすくなります！</p>



<p>また、別の資格に合格できたら勉強法をまとめようと思っているので気長に待っていただけると幸いです。</p>



<p>それでは！</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>最短1日で合格【Webクリエイター能力認定試験 エキスパート】</title>
		<link>https://nabeshiblog.com/web-creator-expert/</link>
		
		<dc:creator><![CDATA[なべし]]></dc:creator>
		<pubDate>Mon, 11 Apr 2022 15:55:21 +0000</pubDate>
				<category><![CDATA[資格]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[勉強]]></category>
		<guid isPermaLink="false">https://nabeshiblog.com/?p=340</guid>

					<description><![CDATA[この資格、エキスパートなんて大層な名前がついてますがめちゃくちゃ簡単です！今回は1日で取得できるこの資格にメリットはあるのか、勉強方法について解説していきます。 試験に合格するメリット Web系のことを全く知らない人に対 [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>この資格、エキスパートなんて大層な名前がついてますがめちゃくちゃ簡単です！<br>今回は1日で取得できるこの資格にメリットはあるのか、勉強方法について解説していきます。</p>



<h2 class="wp-block-heading"><span id="toc1">試験に合格するメリット</span></h2>



<p>Web系のことを全く知らない人に対して営業することを想定すると持っておいて損はないと思います。<br>なんてったって【エキスパート】という名前がついているくらいですから、なんか凄そうくらいには思われそうです笑</p>



<p>後は<strong>有効期限がない</strong>ということですね。<br>フロントエンドの知識は移り変わりが早いですが、この資格は１回合格すれば再受験の必要もなく、失効することもありません。</p>



<h2 class="wp-block-heading"><span id="toc2">たった1日勉強するだけで合格するには？</span></h2>



<h3 class="wp-block-heading"><span id="toc3">ステップ1: 参考書を購入する</span></h3>



<p>1日で合格するには必須です。<br>というのも、本の内容と試験の内容がほぼ一緒だからです！<br>効率よく学習するには欠かせませんね。</p>



<!-- START MoshimoAffiliateEasyLink -->
<script type="text/javascript">
(function(b,c,f,g,a,d,e){b.MoshimoAffiliateObject=a;
b[a]=b[a]||function(){arguments.currentScript=c.currentScript
||c.scripts[c.scripts.length-2];(b[a].q=b[a].q||[]).push(arguments)};
c.getElementById(a)||(d=c.createElement(f),d.src=g,
d.id=a,e=c.getElementsByTagName("body")[0],e.appendChild(d))})
(window,document,"script","//dn.msmstatic.com/site/cardlink/bundle.js?20220329","msmaflink");
msmaflink({"n":"Webクリエイター能力認定試験HTML5対応エキスパート公式テキスト サーティファイWeb利用・技術認定委員会公認 [ 狩野祐東 ]","b":"","t":"","d":"https:\/\/thumbnail.image.rakuten.co.jp","c_p":"","p":["\/@0_mall\/book\/cabinet\/2062\/9784865102062.jpg"],"u":{"u":"https:\/\/item.rakuten.co.jp\/book\/13177648\/","t":"rakuten","r_v":""},"v":"2.1","b_l":[{"id":2,"u_tx":"Amazonで見る","u_bc":"#f79256","u_url":"https:\/\/amzn.to\/3LSHXXZ","a_id":0,"p_id":0,"pl_id":0,"pc_id":0,"s_n":"custom_2","u_so":1},{"id":1,"u_tx":"楽天市場で見る","u_bc":"#f76956","u_url":"https:\/\/item.rakuten.co.jp\/book\/13177648\/","a_id":3074078,"p_id":54,"pl_id":27059,"pc_id":54,"s_n":"rakuten","u_so":2}],"eid":"QzXF2","s":"s"});
</script>
<div id="msmaflink-QzXF2">リンク</div>
<!-- MoshimoAffiliateEasyLink END -->



<h3 class="wp-block-heading"><span id="toc4">ステップ2: Dreamweaverをダウンロードする</span></h3>



<p>Dreamweaverを知らない方に簡単に説明しておくと、HTMLやCSSのコードをツールだと思ってください。<br>PCに標準でインストールされているメモ帳でもHTMLとCSSは記述できるのですが、Dreamweaverを使用するとある程度予測変換が出てくれるのでHTMLやCSSが不安な方は特にダウンロードした方が良いです。<br>実際の試験でもDreamweaverが使えるので、試験前に操作に慣れておくことをお勧めします。</p>



<p>初めてダウンロードする方は1週間無料で使えます。<br>この期間内に解約してしまえば料金はかかりません。<br>Dreamweaverのダウンロードは<strong><a href="https://www.adobe.com/jp/products/dreamweaver.html?sdid=19SCDRPS&amp;mv=search&amp;ef_id=CjwKCAjwo8-SBhAlEiwAopc9Wx_nW_1d10Y56Ae5kSyUWUv4aLzUN2a6rDTqIpTZk3gFVPImR_ARaxoCe18QAvD_BwE:G:s&amp;s_kwcid=AL!3085!3!476007603099!e!!g!!dreamweaver!739872443!102573497734&amp;gclid=CjwKCAjwo8-SBhAlEiwAopc9Wx_nW_1d10Y56Ae5kSyUWUv4aLzUN2a6rDTqIpTZk3gFVPImR_ARaxoCe18QAvD_BwE">こちら</a></strong></p>



<h3 class="wp-block-heading"><span id="toc5">ステップ3: 参考書を使って勉強する</span></h3>



<p>勉強といっても基本的には参考書に倣ってコードを書いていくだけでOKです。<br>参考書内では「HTML4では〜」とか「XHTMLの書き方は〜」のようなことが書かれていますが、この試験は<strong>HTML5</strong>の試験なのでその辺りは無視して大丈夫です。<br>閉じタグがなくても動作するなどの説明もありますが、あえて閉じタグを書かない(空タグを除く)なんてことはないので、そこも無視でOKです。</p>



<p>参考書の9章でwebデザインの基礎知識を紹介しているのですが、そこは暗記してください。<br>ここも参考書に載っているものだけ問われるので暗記しておけば確実に点を稼げます。</p>



<p>9章まで勉強し終わったら、サンプル問題を解いていきましょう。<br>作成するサイトが少し変わるだけで実装する内容はほぼ同じです。<br>うまく実装できなかった箇所は回答を見て理解しておきましょう。</p>



<p>ここまでできたらあとは受験するだけです！</p>



<h2 class="wp-block-heading"><span id="toc6">おわりに</span></h2>



<p>いかがだったでしょうか？<br>1日で合格できて履歴書に書くこともできるのでかなりコスパの良い資格だと思います。<br>これからWeb制作をしていきたい方は是非挑戦してみてください！</p>



<figure class="wp-block-image size-full"><img decoding="async" width="1000" height="1012" src="https://nabeshiblog.com/wp-content/uploads/2022/04/webクリエイター認定試験.jpg" alt="" class="wp-image-477" srcset="https://nabeshiblog.com/wp-content/uploads/2022/04/webクリエイター認定試験.jpg 1000w, https://nabeshiblog.com/wp-content/uploads/2022/04/webクリエイター認定試験-296x300.jpg 296w, https://nabeshiblog.com/wp-content/uploads/2022/04/webクリエイター認定試験-768x777.jpg 768w, https://nabeshiblog.com/wp-content/uploads/2022/04/webクリエイター認定試験-100x100.jpg 100w" sizes="(max-width: 1000px) 100vw, 1000px" /></figure>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>遅延的束縛完全理解した</title>
		<link>https://nabeshiblog.com/late-static-bind/</link>
		
		<dc:creator><![CDATA[なべし]]></dc:creator>
		<pubDate>Sat, 13 Nov 2021 06:12:40 +0000</pubDate>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[プログラミング]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[php技術者認定試験]]></category>
		<category><![CDATA[資格]]></category>
		<guid isPermaLink="false">https://nabeshiblog.com/?p=295</guid>

					<description><![CDATA[PHP技術者認定試験の勉強で遅延的束縛(Late Static Bind)について調べて完全に理解したので、備忘録として残しておきます！ 遅延的束縛とは PHP5.3.0から導入された遅延的束縛(Late Static  [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>PHP技術者認定試験の勉強で遅延的束縛(Late Static Bind)について調べて完全に理解したので、備忘録として残しておきます！</p>



<h2 class="wp-block-heading"><span id="toc1">遅延的束縛とは</span></h2>



<p>PHP5.3.0から導入された遅延的束縛(Late Static Binding)は簡単にいうと、呼び出すまで実行結果がわからないというものです。</p>



<p>まずは実行前から結果が固定されているパターンから見ていきます。</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-php" data-lang="PHP"><code>&lt;?php
class A
{
  public static function who()
  {
    echo __CLASS__;
  }
  public static function test()
  {
    self::who();
  }
}

class B extends A
{
  public static function who()
  {
    echo __CLASS__;
  }
}

A::test();
B::test();</code></pre></div>



<p>このコードの10行目に記述されている<strong>self</strong>は呼び出し元に関係なく、selfが記述されたクラス内の静的メソッドを呼び出します。<br>なので、Aを継承しているBからtestメソッドを呼び出しても必ずAクラス内のwho()メソッドが呼び出されてAという結果が出力されます。</p>



<p>次は遅延的束縛を利用したパターンです。</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-php" data-lang="PHP"><code>&lt;?php
class A
{
  public static function who()
  {
    echo __CLASS__;
  }
  public static function test()
  {
    static::who();
  }
}

class B extends A
{
  public static function who()
  {
    echo __CLASS__;
  }
}

A::test();
B::test();</code></pre></div>



<p>selfと記述されたいた箇所をstaticに変更しただけで他は同じです。<br><strong>static</strong>は呼び出し元クラスを参照するので、B::test()を呼び出した時のtestメソッド内の処理はB::who()と同じ意味となり、Bと出力します。</p>



<p>このように、呼び出してからstaticの参照先が決まるので遅延的束縛と呼ばれます。</p>



<h2 class="wp-block-heading"><span id="toc2">遅延的束縛をもっと詳しく</span></h2>



<p>冒頭で分かりやすくするためにざっくりと紹介しましたが、遅延的束縛を詳しく説明すると、非転送コール時に明示された<strong>クラス名</strong>を保持する機能と言えます。</p>



<p>まずは非転送コールと転送コールの違いを理解しておきましょう。</p>



<h3 class="wp-block-heading"><span id="toc3">非転送コール</span></h3>



<p>X::foo()や$x-&gt;foo()といったクラス名やオブジェクトを明示的に指定した呼び出し</p>



<h3 class="wp-block-heading"><span id="toc4">転送コール</span></h3>



<p>self::, parent::, static::のこと</p>



<h3 class="wp-block-heading"><span id="toc5">非転送コールと転送コールを使った例</span></h3>



<div class="hcb_wrap"><pre class="prism line-numbers lang-php" data-lang="PHP"><code>&lt;?php
class A
{
  public static function foo()
  {
    static::who();
  }

  public static function who()
  {
    echo __CLASS__ . &quot;\n&quot;;
  }
}

class B extends A
{
  public static function test()
  {
    A::foo();
    parent::foo();
    self::foo();
  }

  public static function who()
  {
    echo __CLASS__ . &quot;\n&quot;;
  }
}
class C extends B
{
  public static function who()
  {
    echo __CLASS__ . &quot;\n&quot;;
  }
}

C::test();</code></pre></div>



<p>Cクラスのtest()メソッドを呼び出すことで、<br><br>A::foo() 転送コール<br>parent::foo() 非転送コール<br>self::foo() 非転送コール<br><br>が実行されます。</p>



<p>C::test()は非転送コールでA::foo()も非転送コール。<br>Aクラス内のwho()メソッドのstaticは直近の非転送コールのクラス名を保持しているためAを指し、A::whoを呼び出すことになり、Aを出力する。</p>



<p>parent::foo()は転送コールなので直近の非転送コールのクラス名を保持します。<br>つまり、foo()メソッド内でC::who()が実行され、Cが出力される。</p>



<p>self::foo()も転送コールなので直近の非転送コールを保持し、foo()メソッド内でC::who()が呼び出されることになり、Cが出力される。</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>MX Keys Miniを一週間使ったのでレビューしてみる</title>
		<link>https://nabeshiblog.com/mx-keys-mini/</link>
		
		<dc:creator><![CDATA[なべし]]></dc:creator>
		<pubDate>Fri, 12 Nov 2021 13:45:58 +0000</pubDate>
				<category><![CDATA[雑記]]></category>
		<guid isPermaLink="false">https://nabeshiblog.com/?p=266</guid>

					<description><![CDATA[とうとうMX Keys Miniが発売開始されましたね！MX Keysのフルキーボードが発売された当初は、「テンキーいらねー」というプログラマーの方も多かったのではないでしょうか？私はMX Keys for Macが発表 [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>とうとうMX Keys Miniが発売開始されましたね！<br>MX Keysのフルキーボードが発売された当初は、「テンキーいらねー」というプログラマーの方も多かったのではないでしょうか？<br>私はMX Keys for Macが発表された時からテンキーレスタイプが発売されたら購入すると決めていたので、やっとその小さな夢が叶いました！笑<br>で、待ちに待った分イマイチだなと感じるところもあったのでそこも紹介していきます！</p>



<h2 class="wp-block-heading"><span id="toc1">良かったポイント</span></h2>



<figure class="wp-block-image size-full"><img decoding="async" width="1000" height="628" src="https://nabeshiblog.com/wp-content/uploads/2021/11/mx_keys_mini.jpg" alt="" class="wp-image-278" srcset="https://nabeshiblog.com/wp-content/uploads/2021/11/mx_keys_mini.jpg 1000w, https://nabeshiblog.com/wp-content/uploads/2021/11/mx_keys_mini-300x188.jpg 300w, https://nabeshiblog.com/wp-content/uploads/2021/11/mx_keys_mini-768x482.jpg 768w" sizes="(max-width: 1000px) 100vw, 1000px" /></figure>



<h3 class="wp-block-heading"><span id="toc2">キーストロークが深い！</span></h3>



<p>個人的にこれを一番重要視している気がします笑</p>



<p>2015~2019年のMacBookはバタフライキーボードを採用していたんですが、そのころのモデルのキーボードを触ったことがある人は「なんじゃこのペチペチは！」と一度は思ったことがあるはず。<br>簡単にいうとキーストロークが<strong>非常に浅い</strong>です。<br>私はこのペチペチが嫌で2021年まで2013年モデルのMacBook Airを使っていました笑</p>



<h3 class="wp-block-heading"><span id="toc3">バッテリー長持ち！</span></h3>



<p>以前使用していたキーボードがApple Wireless KeyboardなだけあってMX Keys Miniのバッテリーの持ちの良さは段違いですね！<br>公式によるとバックライトオフだと最長で5ヶ月バッテリーが持つらしいです！<br>確かに開封初日に充電してからまだ一度も充電ケーブルを差していないです。<br>恐ろしいですね笑</p>



<h3 class="wp-block-heading"><span id="toc4">角度がちょうどいい！</span></h3>



<p>ノートPCにスタンド付けてる人はここ重要だと思います！<br>スタンドをつけているとキーボードの角度が上がって打ちやすいなと感じる人は絶対MX Keys Mini買った方がいいです！<br>Magic Keyboardもいいんですが角度が浅くてタイピングしづらいんですよね。。。<br>これって私だけですか？笑</p>



<h2 class="wp-block-heading"><span id="toc5">ちょっと残念ポイント</span></h2>



<p>MX Keys Miniはコンパクトで非常に使いやすいキーボードなんですが、個人的にすこーし残念なポイントがあります。。<br>もしかすると私と同じ価値観の人もいるかもしれないので参考にしてください！</p>



<h3 class="wp-block-heading"><span id="toc6">ファンクションキー</span></h3>



<p>ファンクションキーを多用される方は<strong>要注意</strong>です！<br>MacBook内蔵のキーボードと比較するとこんな感じです。</p>



<p>MacBook内蔵キーボード</p>



<figure class="wp-block-image size-full"><img decoding="async" width="1000" height="59" src="https://nabeshiblog.com/wp-content/uploads/2021/11/fn1.jpg" alt="" class="wp-image-279" srcset="https://nabeshiblog.com/wp-content/uploads/2021/11/fn1.jpg 1000w, https://nabeshiblog.com/wp-content/uploads/2021/11/fn1-300x18.jpg 300w, https://nabeshiblog.com/wp-content/uploads/2021/11/fn1-768x45.jpg 768w" sizes="(max-width: 1000px) 100vw, 1000px" /></figure>



<p>MX Keys Mini</p>



<figure class="wp-block-image size-full"><img decoding="async" width="1000" height="66" src="https://nabeshiblog.com/wp-content/uploads/2021/11/fn2.jpg" alt="" class="wp-image-280" srcset="https://nabeshiblog.com/wp-content/uploads/2021/11/fn2.jpg 1000w, https://nabeshiblog.com/wp-content/uploads/2021/11/fn2-300x20.jpg 300w, https://nabeshiblog.com/wp-content/uploads/2021/11/fn2-768x51.jpg 768w" sizes="(max-width: 1000px) 100vw, 1000px" /></figure>



<p>普段からファンクションキーを多用しないので不便に感じるほどではないですが、MX Keys Miniはディスプレイの明るさが変更できないです。。。<br>MacBookをモニターに繋いでディアルディスプレイにしている人はちょっと不便に感じるかもしれないです。</p>



<p>スクリーンショットと絵文字のキーが追加されましたがショートカットを知っているのでほぼ使うことはないです笑<br><br>スクリーンショットのショートカット<br>画面全体をキャプチャする場合は Command + Shift + 3、<br>キャブチャする範囲を指定したい場合は Command + Shift + 4<br><br>絵文字のショートカット<br>Command + Space + Control</p>



<p>コロナのせいでオンラインでミーティングする人はマイクをミュートするキーは便利かもしれません！<br>でも、何かの拍子にミュートのキーに手が当たってしまった時はミュートが解除されるので注意が必要です。。。</p>



<h3 class="wp-block-heading"><span id="toc7">キートップのくぼみ</span></h3>



<p>MX Keys Miniを使い始めたばかりの頃はこのくぼみのせいで、キートップが指先に引っかかる感じがしてタイピング速度が著しく落ちました。<br>後、なぜかタイプミスも増えてました。。。<br>個人的にはこのキートップのくぼみは無くてもいいのかなーって思ってます笑<br>ただ、これは慣れの問題で、一週間経った今では気にならなくなっているので購入するかどうかの判断基準にはならないと思います！<br>慣れが必要ということだけ覚えておいてください！</p>



<p>と、こんな感じでちょっと残念なポイントを書いてみましたが、この記事を書いている今では残念に思ってないです笑<br>むしろ使いやすいと思ってます！</p>



<h2 class="wp-block-heading"><span id="toc8">購入方法</span></h2>



<h3 class="wp-block-heading"><span id="toc9">JIS配列</span></h3>



<p>JIS配列のキーボードはロジクールのMX Keys Miniのページか、Amazon、楽天で購入できます！<br><strong>Amazonの方が安い</strong>ことがあるのでAmazonと楽天を比較してくださいね&#x1f601;</p>



<!-- START MoshimoAffiliateEasyLink --><script type="text/javascript">(function(b,c,f,g,a,d,e){b.MoshimoAffiliateObject=a;b[a]=b[a]||function(){arguments.currentScript=c.currentScript||c.scripts[c.scripts.length-2];(b[a].q=b[a].q||[]).push(arguments)};c.getElementById(a)||(d=c.createElement(f),d.src=g,d.id=a,e=c.getElementsByTagName("body")[0],e.appendChild(d))})(window,document,"script","//dn.msmstatic.com/site/cardlink/bundle.js?20210203","msmaflink");msmaflink({"n":"【新製品】ロジクール ワイヤレス キーボード KX700 MX KEYS mini 充電式 bluetooth Unifying非対応 無線 テンキーレス KX700GR KX700PG KX700RO 国内正規品 2年間無償保証","b":"","t":"","d":"https:\/\/thumbnail.image.rakuten.co.jp","c_p":"\/@0_mall\/logicool\/cabinet\/prd\/kb\/kx700gr","p":["\/kx700gr_01_n_.jpg","\/kx700gr_02.jpg","\/kx700gr_03.jpg"],"u":{"u":"https:\/\/item.rakuten.co.jp\/logicool\/kx700gr\/","t":"rakuten","r_v":""},"v":"2.1","b_l":[{"u_bc":"#f79256","u_tx":"Amazonで見る","u_url":"https:\/\/amzn.to\/3qwsZ2v","s_n":"custom_2","u_so":0,"a_id":0,"p_id":0,"pc_id":0,"pl_id":0,"id":2},{"id":1,"u_tx":"楽天市場で見る","u_bc":"#f76956","u_url":"https:\/\/item.rakuten.co.jp\/logicool\/kx700gr\/","a_id":3074078,"p_id":54,"pl_id":27059,"pc_id":54,"s_n":"rakuten","u_so":1}],"eid":"N77qM","s":"s"});</script><div id="msmaflink-N77qM">リンク</div><!-- MoshimoAffiliateEasyLink END -->



<h3 class="wp-block-heading"><span id="toc10">US配列</span></h3>



<p>US配列のキーボードは現状日本での取り扱いはないようです。。。<br>MX Keysシリーズの傾向から考えると日本ではJIS配列のみしか販売されいないと思います。</p>



<p>US配列のMX Keys Miniを購入するには<strong>個人輸入</strong>するしかないです&#x1f62d;<br>「個人輸入」と聞くとそれだけで購入を諦めてしまいそうですが、個人輸入は今や英語が読み書きできなくてもできるようになっているので是非お試しください！</p>



<div class="wp-block-cocoon-blocks-blogcard blogcard-type bct-none">

<a href="https://nabeshiblog.com/shipito/" title="【Shipito使い方徹底解説】初めての個人輸入でも安心" class="blogcard-wrap internal-blogcard-wrap a-wrap cf"><div class="blogcard internal-blogcard ib-left cf"><div class="blogcard-label internal-blogcard-label"><span class="fa"></span></div><figure class="blogcard-thumbnail internal-blogcard-thumbnail"><img decoding="async" width="160" height="99" src="https://nabeshiblog.com/wp-content/uploads/2021/11/Shipito-160x99.png" class="blogcard-thumb-image internal-blogcard-thumb-image wp-post-image" alt="" srcset="https://nabeshiblog.com/wp-content/uploads/2021/11/Shipito-160x99.png 160w, https://nabeshiblog.com/wp-content/uploads/2021/11/Shipito-120x74.png 120w, https://nabeshiblog.com/wp-content/uploads/2021/11/Shipito-320x198.png 320w" sizes="(max-width: 160px) 100vw, 160px" /></figure><div class="blogcard-content internal-blogcard-content"><div class="blogcard-title internal-blogcard-title">【Shipito使い方徹底解説】初めての個人輸入でも安心</div><div class="blogcard-snippet internal-blogcard-snippet">個人輸入ってハードル高いと思ってませんか？恐らくハードルが高いと感じる要因は英語（外国語）ができるかが大きく関わってきていると思います。もし日本語で個人輸入ができたら簡単ですよね？今回は初めての人でも簡単に個人輸入できたサービスを紹介します！</div></div><div class="blogcard-footer internal-blogcard-footer cf"><div class="blogcard-site internal-blogcard-site"><div class="blogcard-favicon internal-blogcard-favicon"><img decoding="async" src="https://www.google.com/s2/favicons?domain=https://nabeshiblog.com" alt="" class="blogcard-favicon-image internal-blogcard-favicon-image" width="16" height="16" /></div><div class="blogcard-domain internal-blogcard-domain">nabeshiblog.com</div></div><div class="blogcard-date internal-blogcard-date"><div class="blogcard-post-date internal-blogcard-post-date">2021.11.04</div></div></div></div></a>
</div>



<h2 class="wp-block-heading"><span id="toc11">まとめ</span></h2>



<p>MX Keys Miniを開封して直後に使用した時はちょっと残念なポイントがあるなーと思っていましたが、１週間使用してその残念なポイントは気にならなくなったので、総合的に非常に良いキーボードだと思います！</p>



<p>デスクを広く使いたい方、テンキーが不要な方、今使っているキーボードの打鍵音が気になる方は是非購入してみてください&#x1f601;</p>



<!-- START MoshimoAffiliateEasyLink --><script type="text/javascript">(function(b,c,f,g,a,d,e){b.MoshimoAffiliateObject=a;b[a]=b[a]||function(){arguments.currentScript=c.currentScript||c.scripts[c.scripts.length-2];(b[a].q=b[a].q||[]).push(arguments)};c.getElementById(a)||(d=c.createElement(f),d.src=g,d.id=a,e=c.getElementsByTagName("body")[0],e.appendChild(d))})(window,document,"script","//dn.msmstatic.com/site/cardlink/bundle.js?20210203","msmaflink");msmaflink({"n":"【新製品】ロジクール ワイヤレス キーボード KX700 MX KEYS mini 充電式 bluetooth Unifying非対応 無線 テンキーレス KX700GR KX700PG KX700RO 国内正規品 2年間無償保証","b":"","t":"","d":"https:\/\/thumbnail.image.rakuten.co.jp","c_p":"\/@0_mall\/logicool\/cabinet\/prd\/kb\/kx700gr","p":["\/kx700gr_01_n_.jpg","\/kx700gr_02.jpg","\/kx700gr_03.jpg"],"u":{"u":"https:\/\/item.rakuten.co.jp\/logicool\/kx700gr\/","t":"rakuten","r_v":""},"v":"2.1","b_l":[{"u_bc":"#f79256","u_tx":"Amazonで見る","u_url":"https:\/\/amzn.to\/3qwsZ2v","s_n":"custom_2","u_so":0,"a_id":0,"p_id":0,"pc_id":0,"pl_id":0,"id":2},{"id":1,"u_tx":"楽天市場で見る","u_bc":"#f76956","u_url":"https:\/\/item.rakuten.co.jp\/logicool\/kx700gr\/","a_id":3074078,"p_id":54,"pl_id":27059,"pc_id":54,"s_n":"rakuten","u_so":1}],"eid":"N77qM","s":"s"});</script><div id="msmaflink-N77qM">リンク</div><!-- MoshimoAffiliateEasyLink END -->
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>【Shipito使い方徹底解説】初めての個人輸入でも安心</title>
		<link>https://nabeshiblog.com/shipito/</link>
		
		<dc:creator><![CDATA[なべし]]></dc:creator>
		<pubDate>Thu, 04 Nov 2021 02:54:40 +0000</pubDate>
				<category><![CDATA[雑記]]></category>
		<guid isPermaLink="false">https://nabeshiblog.com/?p=209</guid>

					<description><![CDATA[個人輸入ってハードル高いと思ってませんか？恐らくハードルが高いと感じる要因は英語（外国語）ができるかが大きく関わってきていると思います。もし日本語で個人輸入ができたら簡単ですよね？ 今回は初めての人でも簡単に個人輸入でき [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>個人輸入って<strong>ハードル高い</strong>と思ってませんか？<br>恐らくハードルが高いと感じる要因は英語（外国語）ができるかが大きく関わってきていると思います。<br>もし<strong>日本語</strong>で個人輸入ができたら簡単ですよね？</p>



<p>今回は初めての人でも簡単に個人輸入できたサービスを紹介します！</p>



<h2 class="wp-block-heading"><span id="toc1">Shipitoとは</span></h2>



<p>簡単に言うと<strong>荷物を転送するサービスの会社</strong>です。</p>



<p>個人輸入が初めての人からすると「は？個人輸入なのに転送？」って感じですよね笑<br>個人輸入は２つパターンがあるので順番に図でざっくり説明します！</p>



<p>1つ目<br><span style="text-align: -webkit-match-parent;">商品を購入した店が荷物を発送しするパターン</span></p>



<figure class="wp-block-image size-full"><img decoding="async" width="1000" height="561" src="https://nabeshiblog.com/wp-content/uploads/2021/11/shipito-2.png" alt="" class="wp-image-210" srcset="https://nabeshiblog.com/wp-content/uploads/2021/11/shipito-2.png 1000w, https://nabeshiblog.com/wp-content/uploads/2021/11/shipito-2-300x168.png 300w, https://nabeshiblog.com/wp-content/uploads/2021/11/shipito-2-768x431.png 768w, https://nabeshiblog.com/wp-content/uploads/2021/11/shipito-2-120x68.png 120w, https://nabeshiblog.com/wp-content/uploads/2021/11/shipito-2-160x90.png 160w, https://nabeshiblog.com/wp-content/uploads/2021/11/shipito-2-320x180.png 320w" sizes="(max-width: 1000px) 100vw, 1000px" /></figure>



<p>2つ目<br><span style="text-align: -webkit-match-parent;">商品を購入した店が海外発送に対応していない場合はその国の住所を取得してその住所に発送してもらい、そこから自分の家に荷物を発送するパターン</span><br>Shipitoはまさにこれです！<br><meta charset="utf-8"><a rel="noopener" href="https://www.shipito.com/?id_affiliate=18714" target="_blank">Shipitoに登録（<strong>無料</strong>）する</a>とアメリカの住所が自動で割り振られて、その住所に一旦荷物を送ってもらってそこから日本の自宅に向けて発送するという流れです</p>



<figure class="wp-block-image size-full"><img decoding="async" width="1000" height="561" src="https://nabeshiblog.com/wp-content/uploads/2021/11/shipito2-2.png" alt="" class="wp-image-211" srcset="https://nabeshiblog.com/wp-content/uploads/2021/11/shipito2-2.png 1000w, https://nabeshiblog.com/wp-content/uploads/2021/11/shipito2-2-300x168.png 300w, https://nabeshiblog.com/wp-content/uploads/2021/11/shipito2-2-768x431.png 768w, https://nabeshiblog.com/wp-content/uploads/2021/11/shipito2-2-120x68.png 120w, https://nabeshiblog.com/wp-content/uploads/2021/11/shipito2-2-160x90.png 160w, https://nabeshiblog.com/wp-content/uploads/2021/11/shipito2-2-320x180.png 320w" sizes="(max-width: 1000px) 100vw, 1000px" /></figure>



<p>Shipito以外にも転送サービスはあるのですが、なぜShipitoを選んだのかを紹介します！</p>



<h2 class="wp-block-heading"><span id="toc2">Shipitoを選んだ理由</span></h2>



<p>かなり個人的な内容なんですが選んだ理由は以下の3つです！<br>日本語対応していることも選んだ理由にしたかったのですが、他の転送サービスでも日本語対応しているものがあるので省きました&#x1f647;&#x200d;&#x2642;&#xfe0f;</p>



<ol class="wp-block-list"><li><span style="text-align: -webkit-match-parent;">住所の取得が簡単</span></li><li>月額費無料</li><li>デザインがシンプルで使いやすい</li></ol>



<h3 class="wp-block-heading"><span id="toc3">住所の取得が簡単</span></h3>



<p>住所の取得がめちゃくちゃ簡単です！<br>Shipitoに登録すれば自動で住所の取得までやってくれるのはありがたいですね！</p>



<h3 class="wp-block-heading"><span id="toc4">月額費無料</span></h3>



<p>個人輸入が初めてだとどこにお金がかかるか不安な部分があるので月額費無料だと変に緊張しなくていいですよね笑</p>



<h3 class="wp-block-heading"><span id="toc5">デザインがシンプルで使いやすい</span></h3>



<p>どこに何があるかが非常にわかりやすくて非常使いやすいです！<br>初めての方は使いやすさも重要ですよね！</p>



<h2 class="wp-block-heading"><span id="toc6">使い方</span></h2>



<h3 class="wp-block-heading"><span id="toc7">アカウントを作成する</span></h3>



<p>これはめちゃくちゃ簡単ですね！<br><a rel="noopener" href="https://www.shipito.com/?id_affiliate=18714" target="_blank">Shipito</a>のホームページにアクセスして無料登録ボタンを押してプランは「無料」を選択してください！</p>



<figure class="wp-block-image size-full"><img decoding="async" width="1000" height="625" src="https://nabeshiblog.com/wp-content/uploads/2021/11/shipito_top.jpg" alt="" class="wp-image-219" srcset="https://nabeshiblog.com/wp-content/uploads/2021/11/shipito_top.jpg 1000w, https://nabeshiblog.com/wp-content/uploads/2021/11/shipito_top-300x188.jpg 300w, https://nabeshiblog.com/wp-content/uploads/2021/11/shipito_top-768x480.jpg 768w" sizes="(max-width: 1000px) 100vw, 1000px" /></figure>



<figure class="wp-block-image size-full"><img decoding="async" width="1000" height="625" src="https://nabeshiblog.com/wp-content/uploads/2021/11/shipito_plan.jpg" alt="" class="wp-image-220" srcset="https://nabeshiblog.com/wp-content/uploads/2021/11/shipito_plan.jpg 1000w, https://nabeshiblog.com/wp-content/uploads/2021/11/shipito_plan-300x188.jpg 300w, https://nabeshiblog.com/wp-content/uploads/2021/11/shipito_plan-768x480.jpg 768w" sizes="(max-width: 1000px) 100vw, 1000px" /></figure>



<p>後は上から順に項目を埋めて「アカウントを作成」ボタンを押してアカウントを作成しましょう！<br>このとき紹介コードを入力すると初回購入時に自動で<strong>15%OFF</strong>が適用されるらしいので入力しましょう！<br>私が登録した時は他のサイトを見ずに進めていたせいで「紹介コードなんてものはない！」ということで飛ばしてしまいました。。。<br>紹介コードは「<strong>BFL500</strong>」です！</p>



<figure class="wp-block-image size-full"><img decoding="async" width="1000" height="625" src="https://nabeshiblog.com/wp-content/uploads/2021/11/shipito_account-1.jpg" alt="" class="wp-image-222" srcset="https://nabeshiblog.com/wp-content/uploads/2021/11/shipito_account-1.jpg 1000w, https://nabeshiblog.com/wp-content/uploads/2021/11/shipito_account-1-300x188.jpg 300w, https://nabeshiblog.com/wp-content/uploads/2021/11/shipito_account-1-768x480.jpg 768w" sizes="(max-width: 1000px) 100vw, 1000px" /></figure>



<p>アカウントの作成が完了するとメールが届くはずなので、届いたメールを開いて認証を行います。</p>



<p>認証ができたらもう1通メールが届くはずです！<br>そのメール内にShipitoが自動で取得してくれた住所が書いてありますが、暗記したりこのメールを大事に保管しておく必要はありません！！<br>Shipitoにログインするといつでも住所は確認できるので大丈夫です&#x1f601;</p>



<p>住所の確認方法は「マイ倉庫の住所」の上にマウスカーソルを乗せるだけで確認できます！</p>



<figure class="wp-block-image size-full"><img decoding="async" width="1000" height="614" src="https://nabeshiblog.com/wp-content/uploads/2021/11/shipito_store.jpg" alt="" class="wp-image-223" srcset="https://nabeshiblog.com/wp-content/uploads/2021/11/shipito_store.jpg 1000w, https://nabeshiblog.com/wp-content/uploads/2021/11/shipito_store-300x184.jpg 300w, https://nabeshiblog.com/wp-content/uploads/2021/11/shipito_store-768x472.jpg 768w" sizes="(max-width: 1000px) 100vw, 1000px" /></figure>



<p>これでShipitoが荷物を受け取る準備は整いました！<br>後は購入した商品をこの住所に送るだけです！</p>



<h3 class="wp-block-heading"><span id="toc8">住所を登録する</span></h3>



<p>自動で取得した住所とは別に自宅の住所を登録が必要です。</p>



<p><meta charset="utf-8">まずは右上の「マイアカウント」をクリックしてメンバーシップページを表示します。</p>



<figure class="wp-block-image size-full"><img decoding="async" width="1000" height="614" src="https://nabeshiblog.com/wp-content/uploads/2021/11/shipito_myaccount.png" alt="" class="wp-image-226" srcset="https://nabeshiblog.com/wp-content/uploads/2021/11/shipito_myaccount.png 1000w, https://nabeshiblog.com/wp-content/uploads/2021/11/shipito_myaccount-300x184.png 300w, https://nabeshiblog.com/wp-content/uploads/2021/11/shipito_myaccount-768x472.png 768w" sizes="(max-width: 1000px) 100vw, 1000px" /></figure>



<figure class="wp-block-image size-full"><img decoding="async" width="1000" height="614" src="https://nabeshiblog.com/wp-content/uploads/2021/11/shipito_myaccount-1.jpg" alt="" class="wp-image-228" srcset="https://nabeshiblog.com/wp-content/uploads/2021/11/shipito_myaccount-1.jpg 1000w, https://nabeshiblog.com/wp-content/uploads/2021/11/shipito_myaccount-1-300x184.jpg 300w, https://nabeshiblog.com/wp-content/uploads/2021/11/shipito_myaccount-1-768x472.jpg 768w" sizes="(max-width: 1000px) 100vw, 1000px" /></figure>



<p>サイドメニューの「アドレス帳を変更する」をクリックしてアドレス帳ページを開いて下にスクロールすると「新しい住所を追加する」ボタンがあるのでクリックしてください。</p>



<figure class="wp-block-image size-full"><img decoding="async" width="1000" height="614" src="https://nabeshiblog.com/wp-content/uploads/2021/11/shipito_address.jpg" alt="" class="wp-image-229" srcset="https://nabeshiblog.com/wp-content/uploads/2021/11/shipito_address.jpg 1000w, https://nabeshiblog.com/wp-content/uploads/2021/11/shipito_address-300x184.jpg 300w, https://nabeshiblog.com/wp-content/uploads/2021/11/shipito_address-768x472.jpg 768w" sizes="(max-width: 1000px) 100vw, 1000px" /></figure>



<figure class="wp-block-image size-full"><img decoding="async" width="1000" height="614" src="https://nabeshiblog.com/wp-content/uploads/2021/11/shipito_address2-2.png" alt="" class="wp-image-230" srcset="https://nabeshiblog.com/wp-content/uploads/2021/11/shipito_address2-2.png 1000w, https://nabeshiblog.com/wp-content/uploads/2021/11/shipito_address2-2-300x184.png 300w, https://nabeshiblog.com/wp-content/uploads/2021/11/shipito_address2-2-768x472.png 768w" sizes="(max-width: 1000px) 100vw, 1000px" /></figure>



<figure class="wp-block-image size-full"><img decoding="async" width="1000" height="614" src="https://nabeshiblog.com/wp-content/uploads/2021/11/shipito_address3.jpg" alt="" class="wp-image-231" srcset="https://nabeshiblog.com/wp-content/uploads/2021/11/shipito_address3.jpg 1000w, https://nabeshiblog.com/wp-content/uploads/2021/11/shipito_address3-300x184.jpg 300w, https://nabeshiblog.com/wp-content/uploads/2021/11/shipito_address3-768x472.jpg 768w" sizes="(max-width: 1000px) 100vw, 1000px" /></figure>



<p>この画面になったら住所を入力していくのですが、<strong>全てローマ字で入力</strong>してください！<br>ここは慣れてないと大変なので<a href="https://kimini.jp/">このサイト</a>で一旦変換してもらったものを当てはめていくと簡単です&#x1f44d;</p>



<p>「この住所のニックネーム」は「MY ADDRESS」と入力しておいてください！</p>



<p>「社名」「納税者番号/ビジネスID」は必須の項目ではないので飛ばしてOKです！</p>



<p>「こちらを規定住所に指定する」をチェックしたら「保存する」ボタンをクリックして保存しましょう。</p>



<p>これで住所の登録は完了です！</p>



<h3 class="wp-block-heading"><span id="toc9">クレジットカードを登録する</span></h3>



<p>当たり前なんですが、Shipitoから自宅に荷物を発送するときに送料がかかります。<br>そのときに支払いをするクレジットカードが必要になるんですが、クレジットカードの登録にちょっとクセがあります。。。</p>



<p>サイドメニューの「保存済みの支払い方法」を選択して「保存済み支払方法」ページに移動します。</p>



<figure class="wp-block-image size-full"><img decoding="async" width="1000" height="614" src="https://nabeshiblog.com/wp-content/uploads/2021/11/shipito_card.jpg" alt="" class="wp-image-233" srcset="https://nabeshiblog.com/wp-content/uploads/2021/11/shipito_card.jpg 1000w, https://nabeshiblog.com/wp-content/uploads/2021/11/shipito_card-300x184.jpg 300w, https://nabeshiblog.com/wp-content/uploads/2021/11/shipito_card-768x472.jpg 768w" sizes="(max-width: 1000px) 100vw, 1000px" /></figure>



<p>移動できたら「カードを追加する」ボタンをクリックしてカード情報を入力していきましょう！</p>



<figure class="wp-block-image size-full"><img decoding="async" width="1000" height="614" src="https://nabeshiblog.com/wp-content/uploads/2021/11/shipito_card2.jpg" alt="" class="wp-image-234" srcset="https://nabeshiblog.com/wp-content/uploads/2021/11/shipito_card2.jpg 1000w, https://nabeshiblog.com/wp-content/uploads/2021/11/shipito_card2-300x184.jpg 300w, https://nabeshiblog.com/wp-content/uploads/2021/11/shipito_card2-768x472.jpg 768w" sizes="(max-width: 1000px) 100vw, 1000px" /></figure>



<figure class="wp-block-image size-full"><img decoding="async" width="1000" height="614" src="https://nabeshiblog.com/wp-content/uploads/2021/11/shipito_card3.jpg" alt="" class="wp-image-235" srcset="https://nabeshiblog.com/wp-content/uploads/2021/11/shipito_card3.jpg 1000w, https://nabeshiblog.com/wp-content/uploads/2021/11/shipito_card3-300x184.jpg 300w, https://nabeshiblog.com/wp-content/uploads/2021/11/shipito_card3-768x472.jpg 768w" sizes="(max-width: 1000px) 100vw, 1000px" /></figure>



<p>カード情報を入力し終えて以下のような画面になればOKです！</p>



<figure class="wp-block-image size-full"><img decoding="async" width="1000" height="614" src="https://nabeshiblog.com/wp-content/uploads/2021/11/shipito_card4.jpg" alt="" class="wp-image-236" srcset="https://nabeshiblog.com/wp-content/uploads/2021/11/shipito_card4.jpg 1000w, https://nabeshiblog.com/wp-content/uploads/2021/11/shipito_card4-300x184.jpg 300w, https://nabeshiblog.com/wp-content/uploads/2021/11/shipito_card4-768x472.jpg 768w" sizes="(max-width: 1000px) 100vw, 1000px" /></figure>



<p>ここからが少しクセがあります。。。</p>



<p>登録したカードの明細に$0.01~$5.00ドル引き落とし記載されるので、その引き落とされた金額を入力するのですが、明細に記録されるまでに最大で24時間かかるので少し待つ必要があります。。。</p>



<p>こんな感じで明細に記載されます！</p>



<figure class="wp-block-image size-full"><img decoding="async" width="669" height="35" src="https://nabeshiblog.com/wp-content/uploads/2021/11/shipito_card5.png" alt="" class="wp-image-238" srcset="https://nabeshiblog.com/wp-content/uploads/2021/11/shipito_card5.png 669w, https://nabeshiblog.com/wp-content/uploads/2021/11/shipito_card5-300x16.png 300w" sizes="(max-width: 669px) 100vw, 669px" /></figure>



<p>明細に記載されたらその金額を入力して「引き落としを承認する」ボタンを押して承認完了です！</p>



<p>荷物が割り当てられた住所に届くまでにしておくことはこれで完了です！</p>



<h3 class="wp-block-heading"><span id="toc10">荷物が届いたらすること</span></h3>



<p>ここからはShipitoが自動で割り振った住所に荷物が届いてから行う作業になります！</p>



<p>荷物が届くとこんな感じで、「マイ荷物」&gt;「倉庫の荷物」&gt;「要対応」のバッジが0から1になります！<br>荷物の外観の写真も無料で載せてくれます！</p>



<p>有料にはなりますが「追加サービスを追加する」ボタンからオプションを追加することで荷物の外観だけでなく、中身をテーブルに広げた写真も掲載してくれるようになります！</p>



<p>この時点で注文したものじゃないことがわかると返品対応もしてくれるのでありがたいですね&#x1f601;</p>



<figure class="wp-block-image size-full"><img decoding="async" width="1000" height="614" src="https://nabeshiblog.com/wp-content/uploads/2021/11/shipito_store-2.jpg" alt="" class="wp-image-242" srcset="https://nabeshiblog.com/wp-content/uploads/2021/11/shipito_store-2.jpg 1000w, https://nabeshiblog.com/wp-content/uploads/2021/11/shipito_store-2-300x184.jpg 300w, https://nabeshiblog.com/wp-content/uploads/2021/11/shipito_store-2-768x472.jpg 768w" sizes="(max-width: 1000px) 100vw, 1000px" /></figure>



<p>荷物の確認ができたら次は「税関申告」です。</p>



<p>見るからに面倒臭そうですよね。。。</p>



<p>ですが、荷物の中身がどういったものなのかをチェック形式で選択するだけなので非常に簡単です！</p>



<figure class="wp-block-image size-full"><img decoding="async" width="1000" height="813" src="https://nabeshiblog.com/wp-content/uploads/2021/11/declaration.jpg" alt="" class="wp-image-245" srcset="https://nabeshiblog.com/wp-content/uploads/2021/11/declaration.jpg 1000w, https://nabeshiblog.com/wp-content/uploads/2021/11/declaration-300x244.jpg 300w, https://nabeshiblog.com/wp-content/uploads/2021/11/declaration-768x624.jpg 768w" sizes="(max-width: 1000px) 100vw, 1000px" /></figure>



<p>税関申告書の作成が完了したら後は発送するだけです！</p>



<h3 class="wp-block-heading"><span id="toc11">荷物を発送する</span></h3>



<p>税関申告書の作成が完了した状態で「マイ荷物」&gt;「倉庫の荷物」&gt;「出荷準備完了」から「荷物を発送する」ボタンを押しましょう。</p>



<figure class="wp-block-image size-full"><img decoding="async" width="1000" height="614" src="https://nabeshiblog.com/wp-content/uploads/2021/11/shipito_ready-3.jpg" alt="" class="wp-image-247" srcset="https://nabeshiblog.com/wp-content/uploads/2021/11/shipito_ready-3.jpg 1000w, https://nabeshiblog.com/wp-content/uploads/2021/11/shipito_ready-3-300x184.jpg 300w, https://nabeshiblog.com/wp-content/uploads/2021/11/shipito_ready-3-768x472.jpg 768w" sizes="(max-width: 1000px) 100vw, 1000px" /></figure>



<p>ボタンを押すと配送先住所が選択できます。<br>このとき必ず自宅の住所を選択しましょう！</p>



<figure class="wp-block-image size-full"><img decoding="async" width="1000" height="614" src="https://nabeshiblog.com/wp-content/uploads/2021/11/shipito_step2-2.jpg" alt="" class="wp-image-249" srcset="https://nabeshiblog.com/wp-content/uploads/2021/11/shipito_step2-2.jpg 1000w, https://nabeshiblog.com/wp-content/uploads/2021/11/shipito_step2-2-300x184.jpg 300w, https://nabeshiblog.com/wp-content/uploads/2021/11/shipito_step2-2-768x472.jpg 768w" sizes="(max-width: 1000px) 100vw, 1000px" /></figure>



<p>次は配送方法を選択します。</p>



<p>ここはお好みで選択しましょう！<br>（写真撮り忘れました&#x1f647;&#x200d;&#x2642;&#xfe0f;）</p>



<p>次のステップの追加サービスも簡単ですね！</p>



<p>高価な荷物の場合は緩衝材があるとないとでは大違いなのでケチらずにオプションを追加しておくことをお勧めします。</p>



<figure class="wp-block-image size-full"><img decoding="async" width="1000" height="614" src="https://nabeshiblog.com/wp-content/uploads/2021/11/shipito_step4.jpg" alt="" class="wp-image-250" srcset="https://nabeshiblog.com/wp-content/uploads/2021/11/shipito_step4.jpg 1000w, https://nabeshiblog.com/wp-content/uploads/2021/11/shipito_step4-300x184.jpg 300w, https://nabeshiblog.com/wp-content/uploads/2021/11/shipito_step4-768x472.jpg 768w" sizes="(max-width: 1000px) 100vw, 1000px" /></figure>



<p>支払方法は既にクレジットカードを登録しているので選択するだけです！</p>



<figure class="wp-block-image size-full"><img decoding="async" width="1000" height="614" src="https://nabeshiblog.com/wp-content/uploads/2021/11/shipito_step5.jpg" alt="" class="wp-image-251" srcset="https://nabeshiblog.com/wp-content/uploads/2021/11/shipito_step5.jpg 1000w, https://nabeshiblog.com/wp-content/uploads/2021/11/shipito_step5-300x184.jpg 300w, https://nabeshiblog.com/wp-content/uploads/2021/11/shipito_step5-768x472.jpg 768w" sizes="(max-width: 1000px) 100vw, 1000px" /></figure>



<p>これで発送の準備が整いました！<br>最後に「住所」だったり「オプション」の確認をしましょう！<br>間違って不要なオプションを追加している可能性があるのでしっかりと目を通してください！</p>



<figure class="wp-block-image size-full"><img decoding="async" width="1000" height="614" src="https://nabeshiblog.com/wp-content/uploads/2021/11/shipito_step6-1.jpg" alt="" class="wp-image-259" srcset="https://nabeshiblog.com/wp-content/uploads/2021/11/shipito_step6-1.jpg 1000w, https://nabeshiblog.com/wp-content/uploads/2021/11/shipito_step6-1-300x184.jpg 300w, https://nabeshiblog.com/wp-content/uploads/2021/11/shipito_step6-1-768x472.jpg 768w" sizes="(max-width: 1000px) 100vw, 1000px" /></figure>



<p>問題なければ発送しましょう！</p>



<p>後は荷物が届くまでゆっくりと待ちましょう♪</p>



<p>届いた荷物はこんな感じでした！</p>



<p>外の箱が少しひしゃげていたので不安でしたが中身は全然問題なしでした！<br>緩衝材のオプションは必須ですね笑</p>



<figure class="wp-block-image size-full"><img decoding="async" width="1000" height="750" src="https://nabeshiblog.com/wp-content/uploads/2021/11/load1.jpg" alt="" class="wp-image-254" srcset="https://nabeshiblog.com/wp-content/uploads/2021/11/load1.jpg 1000w, https://nabeshiblog.com/wp-content/uploads/2021/11/load1-300x225.jpg 300w, https://nabeshiblog.com/wp-content/uploads/2021/11/load1-768x576.jpg 768w" sizes="(max-width: 1000px) 100vw, 1000px" /></figure>



<figure class="wp-block-image size-full"><img decoding="async" width="1000" height="750" src="https://nabeshiblog.com/wp-content/uploads/2021/11/load2.jpg" alt="" class="wp-image-255" srcset="https://nabeshiblog.com/wp-content/uploads/2021/11/load2.jpg 1000w, https://nabeshiblog.com/wp-content/uploads/2021/11/load2-300x225.jpg 300w, https://nabeshiblog.com/wp-content/uploads/2021/11/load2-768x576.jpg 768w" sizes="(max-width: 1000px) 100vw, 1000px" /></figure>



<h2 class="wp-block-heading"><span id="toc12">まとめ</span></h2>



<p>いかがでしたか？</p>



<p>個人輸入のハードルが高いと感じていた人からすると、「これだけでいいの？」という感じじゃないですか？笑</p>



<p>私のブログの解説がわかりづらいなーという方はShipitoが出している動画を参考に進めていくのもありですね！<br>もちろん日本語の動画もあります&#x1f44d;<br>動画は<a href="https://www.youtube.com/c/Shipitoyou/playlists">こちら</a></p>



<p>Shipito個人輸入が初めての人でも簡単に利用できるので、他の人にも勧めたくなるようなサービスでした！</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>PHPでPDFを出力する方法</title>
		<link>https://nabeshiblog.com/php-pdf/</link>
		
		<dc:creator><![CDATA[なべし]]></dc:creator>
		<pubDate>Fri, 08 Oct 2021 13:25:50 +0000</pubDate>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[プログラミング]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[php技術者認定試験]]></category>
		<category><![CDATA[資格]]></category>
		<guid isPermaLink="false">https://nabeshiblog.com/?p=157</guid>

					<description><![CDATA[今回はPHPのスクリプトからPDFを出力する方法を解説します。ただ、かなり古い書き方です。。PHP5技術者認定試験上級を受験される方にとっては有益な情報になると思うので最後まで目を通してください！ PDFライブラリ PH [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>今回はPHPのスクリプトからPDFを出力する方法を解説します。<br>ただ、かなり古い書き方です。。<br>PHP5技術者認定試験上級を受験される方にとっては有益な情報になると思うので最後まで目を通してください！</p>



<h2 class="wp-block-heading"><span id="toc1">PDFライブラリ</span></h2>



<p>PHPでPDFを出力するライブラリはいくつかあります。<br>有名なところでいうと、<strong>FPDF</strong>、<strong>MBFPDF</strong>、<strong>TCPDF</strong>があります。</p>



<p>これらのライブラリはネット上からダウンロードしてスクリプトにインクルードするだけで使用できる優れものです。<br>リンクを貼っておくのでダウンロードして使ってみてください。<br><strong><a href="http://www.fpdf.org/">FPDF</a></strong>、<strong><a href="https://tcpdf.org/">TCPDF</a></strong><br><strong>MBFPDF</strong>はもう配布されていないのかもしれません。。</p>



<p>FPDFとMBFPDFの使い方は同じだと思って構いません。<br>しかし、日本語のようなマルチバイトの文字をPDFに出力したい場合はMBFPDFを使用してください。</p>



<p>TCPDFはUTF-8での多言語出力に優れていて、PDFをHTMLのタグを使用して記述できます。</p>



<p>試験ではMBFPDFの使い方を問われるようなので、MBFPDFに焦点を当てて解説します。</p>



<h2 class="wp-block-heading"><span id="toc2">基本操作</span></h2>



<p>MBFPDFライブラリを使用するにはまず、mbfpdf.phpをインクルードする必要があります。<br>インクルードしてMBFPDFクラスをインスタンス化すればMBFPDFをすぐに使用できる状態になります。</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-php" data-lang="PHP"><code>require(&#39;./mbfpdf.php&#39;);

$pdf = new MBFPDF();</code></pre></div>



<p>次に使用するフォントを登録します。<br>登録するには<strong>AddMBFontメソッド</strong>を使用します。</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-php" data-lang="PHP"><code>AddMBFont(family, encode);</code></pre></div>



<p>第一引数にはフォントを使用するフォントを指定します。<br>MBFPDFライブラリでは日本語用のフォントが用意されています。<br>以下、用意されているフォントです。<br>(KOZMIN、GOTHIC、PGOTHIC、UIGOTHIC、MINCHO、PMINCHO)</p>



<p>第二引数は文字コードを指定します。<br>指定できる文字コードはSJIS、EUC_JPのみです。<br><strong>UTF-8は指定できません。</strong></p>



<p>第三引数にフォント定義ファイルまでのパスを指定することでそのフォントをスクリプト内で使用することができます。<br>しかし、環境によって日本語が正しく表示されない場合もあるので注意が必要です。</p>



<p>複数フォントを使用したい場合は、その数だけAddMBFontメソッドを呼び出してください。</p>



<p>使用するフォントをGOTHIC、文字コードをSJISにした場合は以下のようになります。</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-php" data-lang="PHP" data-line="5"><code>require(&#39;./mbfpdf.php&#39;);

$pdf = new MBFPDF();

$pdf-&gt;AddMBFont(GOTHIC, &#39;SJIS&#39;);</code></pre></div>



<p>これでGOTHICを使用できるようになりました。</p>



<p>次は新規ページを追加するために<strong>AddPageメソッド</strong>を使用します。<br>このメソッドは引数を取りません。</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-php" data-lang="PHP" data-line="7"><code>require(&#39;./mbfpdf.php&#39;);

$pdf = new MBFPDF();

$pdf-&gt;AddMBFont(GOTHIC, &#39;SJIS&#39;);

$pdf-&gt;AddPage();</code></pre></div>



<p>これで新規ページ（1ページ目）が追加されました。</p>



<p>PDFの出力の際に使用するフォントを設定するには<strong>SetFontメソッド</strong>を使用します。</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-php" data-lang="PHP"><code>SetFont(font, style, size);</code></pre></div>



<p>第一引数にはSetMBFontメソッドで登録したフォントを指定してください。</p>



<p>第二引数のstyleは<strong>B（bold: 太字）</strong>、<strong>I（italic: 斜体）</strong>、<strong>U（underline: 下線）</strong>のいずれかを指定します。</p>



<p>第三引数はフォントサイズを指定します。</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-php" data-lang="PHP" data-line="9"><code>require(&#39;./mbfpdf.php&#39;);

$pdf = new MBFPDF();

$pdf-&gt;AddMBFont(GOTHIC, &#39;SJIS&#39;);

$pdf-&gt;AddPage();

$pdf-&gt;SetFont(GOTHIC, &#39;B&#39;, 20);</code></pre></div>



<p>出力に使用するフォントが指定できました。</p>



<p>テキストを出力する方法はいくつかありますが、セルを使用する方法を紹介します。</p>



<p><strong>Cellメソッド</strong>は指定した範囲の矩形の中にテキストを出力してくれます。<br>部分的に境界線をつけたり、そもそも境界線をつけないことも可能です。</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-php" data-lang="PHP"><code>Cell(width, height, text, border, ln, align);</code></pre></div>



<p>第四引数のboderに0を渡すと境界線なし、1を渡すと境界線ありになります。<br>デフォルトは0です。<br>また、キーワードで指定することも可能です。<br>T（top: 上）、R（right: 右）、B（bottom: 下）、L（left: 左）<br>例えば、左と上だけに境界線を引きたい場合はborderに&#8217;LT&#8217;を渡してください。</p>



<p>第五引数は次のセルの位置をどうするのかを決めます。<br>lnに1を渡すと次のセルは右に配置されるのではなく次の行に移ります。<br>2を渡すと次のセルは下に配置されます。<br>デフォルトの0は次のセルが右に配置されます。</p>



<p>第六引数のalignはテキストの位置を決めます。<br>デフォルトはLでテキストが左端に表示されます。<br>Cを渡すとセルの中央にテキストが表示されます。<br>Rはテキストが右端に表示されます。</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-php" data-lang="PHP" data-line="11"><code>require(&#39;./mbfpdf.php&#39;);

$pdf = new MBFPDF();

$pdf-&gt;AddMBFont(GOTHIC, &#39;SJIS&#39;);

$pdf-&gt;AddPage();

$pdf-&gt;SetFont(GOTHIC, &#39;B&#39;, 20);

$pdf-&gt;Cell(50, 20, &#39;Hello World&#39;) ;</code></pre></div>



<p>幅50、高さ20の境界線のないセルにHello Worldというテキストを出力する準備ができました。</p>



<p>最後に出力する作業が必要です。<br>出力は<strong>Outputメソッド</strong>を呼び出すだけでOKです。</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-php" data-lang="PHP" data-line="13"><code>require(&#39;./mbfpdf.php&#39;);

$pdf = new MBFPDF();

$pdf-&gt;AddMBFont(GOTHIC, &#39;SJIS&#39;);

$pdf-&gt;AddPage();

$pdf-&gt;SetFont(GOTHIC, &#39;B&#39;, 20);

$pdf-&gt;Cell(50, 20, &#39;Hello World&#39;) ;

$pdf-&gt;Output();</code></pre></div>



<p>ブラウザ上にPDFが出力されていれば成功です。</p>



<p><strong>Lnメソッド</strong>を使用すれば縦のセルの間隔を広げることができます。<br>また、このメソッドに引数を渡さず使用すると次のセルが改行して表示されます。</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-php" data-lang="PHP" data-line="13"><code>require(&#39;./mbfpdf.php&#39;);

$pdf = new MBFPDF();

$pdf-&gt;AddMBFont(GOTHIC, &#39;SJIS&#39;);

$pdf-&gt;AddPage();

$pdf-&gt;SetFont(GOTHIC, &#39;B&#39;, 20);

$pdf-&gt;Cell(50, 20, &#39;Hello World&#39;) ;

$pdf-&gt;Ln(5.5);

$pdf-&gt;Cell(50, 20, &#39;Hello PDF&#39;);

$pdf-&gt;Output();</code></pre></div>



<p>Hello WorldのセルとHello PDFのセルの縦の間隔は5.5ptになります。<br>このように空のセルを作ることなくセルの縦の間隔を広げることができました。</p>



<h2 class="wp-block-heading"><span id="toc3">コンストラクタで設定できる値</span></h2>



<p>MBFPDFのコンストラクタではPDFの<strong>用紙の方向</strong>、<strong>座標の単位</strong>、<strong>ページのサイズ</strong>の3つを指定することができます。</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-php" data-lang="PHP"><code>$pdf = new MBFPDF(orientation, unit, size);</code></pre></div>



<p>orientationは用紙の方向を指定します。<br>受け取る値はPかLだけです。<br>デフォルトはPで縦ですが、Lを渡すと横になります。</p>



<p>unitは座標の単位を指定します。<br>受け取る値はpt、in、mm、cmのいずれか一つです。<br>デフォルトはptになっています。</p>



<p>sizeはページのサイズを指定します。<br>受け取る値は、Letter、Legal、A5、A3、A4です。<br>デフォルトはLetterになっています。</p>



<p>A4の横向きのPDFを作成する場合は以下のようなコードになります。(単位はpt)</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-php" data-lang="PHP"><code>$pdf = new MBFPDF(&#39;L&#39;, &#39;pt&#39;, &#39;A4&#39;);</code></pre></div>



<p>コンストラクタで指定した座標の単位がCellメソッドやLnメソッドの単位としても使用されます。</p>



<h2 class="wp-block-heading"><span id="toc4">テキストの色を変更する</span></h2>



<p>テキストの色を変更するには<strong>SetTextColorメソッド</strong>を使用します。<br>このメソッドは必ず、Cellメソッドの前に呼び出してください。</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-php" data-lang="PHP"><code>$pdf-&gt;SetTextColor(red, green, blue);</code></pre></div>



<p>引数にはそれぞれ0~255の値を渡します。<br>第一引数のみ値を渡した場合は、その値が第二引数と第三引数にも適用されます。</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-php" data-lang="PHP" data-line="11,15"><code>require(&#39;./mbfpdf.php&#39;);

$pdf = new MBFPDF();

$pdf-&gt;AddMBFont(GOTHIC, &#39;SJIS&#39;);

$pdf-&gt;AddPage();

$pdf-&gt;SetFont(GOTHIC, &#39;B&#39;, 20);

$pdf-&gt;SetTextColor(255, 0, 0);
$pdf-&gt;Cell(50, 20, &#39;Hello World&#39;) ;
$pdf-&gt;Ln();

$pdf-&gt;SetTextColor(0);
$pdf-&gt;Cell(50, 20, &#39;Hello PDF&#39;);

$pdf-&gt;Output();</code></pre></div>



<h2 class="wp-block-heading"><span id="toc5">セル関連のメソッド</span></h2>



<div class="hcb_wrap"><pre class="prism line-numbers lang-php" data-lang="PHP"><code>$pdf-&gt;SetDrawColor(red, green, blue);</code></pre></div>



<p>セルの境界線の色を指定します。<br>第二引数、第三引数を省略すると第一引数の値がそれぞれ渡されます。</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-php" data-lang="PHP"><code>$pdf-&gt;SetFillColor(red, green, blue);</code></pre></div>



<p>セルの背景色を指定します。<br>第二引数、第三引数を省略した場合の処理は同じです。</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-php" data-lang="PHP"><code>$pdf-&gt;SetLineWidth(width);</code></pre></div>



<p>セルの境界線の太さを指定します。</p>



<h2 class="wp-block-heading"><span id="toc6">ページ関連のメソッド</span></h2>



<div class="hcb_wrap"><pre class="prism line-numbers lang-php" data-lang="PHP"><code>$pdf-&gt;PageNo();</code></pre></div>



<p>現在のページ番号を返します。</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-php" data-lang="PHP"><code>$pdf-&gt;AliasNbPages()</code></pre></div>



<p>このメソッドを実行するとnbという変数が定義され、その変数の中にそうページ数が代入される。</p>



<h2 class="wp-block-heading"><span id="toc7">画像</span></h2>



<p>MBFPDFライブラリで作成するPDF内に画像を挿入する場合は<strong>Imageメソッド</strong>を使用します。</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-php" data-lang="PHP"><code>$pdf-&gt;Image(name, x, y, width, height);</code></pre></div>



<p>表示したい画像の位置をxとyに、サイズをそれぞれwidthとheightに渡してください。<br>widthとheightを省略した場合、MBFPDFが最適な大きさで画像を表示してくれます。</p>



<h2 class="wp-block-heading"><span id="toc8">リンク</span></h2>



<p>MBFPDFは2種類のリンクを作成できます。<br>1つ目は同じドキュメント内のページを跨ぐ内部リンク、2つ目は外部リンクです。</p>



<p>内部リンクを作成するには起点と終点が必要です。<br>起点を指定するには<strong>AddLinkメソッド</strong>、終点を指定するには<strong>SetLinkメソッド</strong>を使用します。<br>AddLinkメソッドの返り値をImageメソッド、Cellメソッド、Writeメソッドのいずれかの引数に渡すことでクリックすることができる画像もしくはテキストを生成できます。<br>SetLinkメソッドの引数には同じようにAddLinkメソッドの返り値を渡します。<br>これで内部リンクの完成です。</p>



<p>Imageメソッド、Cellメソッド、Writeメソッドそれぞれを使用したリンクの生成方法を順に記述しておくので確認しておいてください。</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-php" data-lang="PHP"><code>// Imageメソッドを使用する場合
require(&#39;./mbfpdf.php&#39;);

$pdf = new MBFPDF();

$pdf-&gt;AddPage();

$link = $pdf-&gt;AddLink();
$pdf-&gt;Image(&quot;php.png&quot;, 0, 0, 256, 135, &quot;PNG&quot;, $link); 

$pdf-&gt;AddPage();

$pdf-&gt;SetLink($link);</code></pre></div>



<div class="hcb_wrap"><pre class="prism line-numbers lang-php" data-lang="PHP"><code>// Cellメソッドを使用する場合
require(&#39;./mbfpdf.php&#39;);

$pdf = new MBFPDF();

$pdf-&gt;AddPage();

$link = $pdf-&gt;AddLink();
$pdf-&gt;Cell(50, 10, &#39;ここ&#39;, 0, 0, &#39;L&#39;, false, $link);

$pdf-&gt;AddPage();

$pdf-&gt;SetLink($link);</code></pre></div>



<div class="hcb_wrap"><pre class="prism line-numbers lang-php" data-lang="PHP"><code>// Writeメソッドを使用する場合
require(&#39;./mbfpdf.php&#39;);

$pdf = new MBFPDF();

$pdf-&gt;AddPage();

$link = $pdf-&gt;AddLink();
$pdf-&gt;Write(5, &quot;ここ&quot;, $link);

$pdf-&gt;AddPage();

$pdf-&gt;SetLink($link);</code></pre></div>



<p>外部リンクはAddLinkメソッドとSetLinkメソッドを使用する必要はなく、Imageメソッド、Cellメソッド、Writeメソッドにリンクを渡すだけ大丈夫です。</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>PHP グラフィック処理 ~色~</title>
		<link>https://nabeshiblog.com/php-graphic5/</link>
		
		<dc:creator><![CDATA[なべし]]></dc:creator>
		<pubDate>Thu, 07 Oct 2021 06:20:13 +0000</pubDate>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[プログラミング]]></category>
		<guid isPermaLink="false">https://nabeshiblog.com/?p=144</guid>

					<description><![CDATA[PHPでグラフィック処理をするGDライブラリは、256色の画像だけでなく、アルファチャネル付きのフルカラー画像を扱うことができます。今までに登場したimagecreate関数が256色の画像、imagecreatetru [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>PHPでグラフィック処理をするGDライブラリは、256色の画像だけでなく、アルファチャネル付きのフルカラー画像を扱うことができます。<br>今までに登場した<strong>imagecreate関数</strong>が256色の画像、<strong>imagecreatetruecolor関数</strong>がアルファチャネル付きのフルカラー画像を作成できるという風に覚えておいて問題ないかと思います。<br>使い分けが大変なので基本的にはimagecreatetruecolor関数を使用しておけば大丈夫です。</p>



<p>imagecolorallocate関数を複数回呼び出すと最初に呼び出されたimagecolorallocate関数で指定した色が画像の背景色になっていましたが、imagecreatetruecolor関数で作成した画像には適用されないので注意が必要です。<br>作成した画像にimagefilledrectangle関数で作成した矩形を重ねて描画すると今まで通りのような見え方になります。</p>



<h2 class="wp-block-heading"><span id="toc1">アルファブレンディング</span></h2>



<p>そもそもアルファとはなんなのかというところなんですが、これは透過率です。</p>



<p>アルファブレンディングは透過した時に重なった下の色と上の色を混ぜるかどうかというものです。<br>imagecreatetruecolor関数で作成した画像は初めからアルファブレンディングがオンになっている状態です。<br>もし、アルファブレンディングをオフにしたい場合は、<strong>imagealphablending関数</strong>を使用します。</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-php" data-lang="PHP"><code>imagealphablending(GDImage, flag);</code></pre></div>



<p>imagecreatetruecolor関数で作成した画像にアルファブレンディングを適用しない書き方はこのようになります。</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-php" data-lang="PHP"><code>$image = imagecreatetruecolor(200, 200);
imagealphablending($image, false);</code></pre></div>



<h2 class="wp-block-heading"><span id="toc2">透過処理</span></h2>



<p>PHPで色の透過の設定を行うには<strong>imagecolorallocatealpha関数</strong>を使用します。</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-php" data-lang="PHP"><code>imagecolorallocatealpha(GDImage, red, green, blue, alpha)</code></pre></div>



<p>基本的な使い方はimagecolorallocate関数と同じですが、alphaという引数に0~127の値を渡してください。<br>0は完全に不透明、127は完全に透明になります。</p>



<p>青色の四角の上にalpha50の赤色の楕円を乗せるとこのようになります。</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-php" data-lang="PHP"><code>$image = imagecreatetruecolor(200, 200);

$blue = imagecolorallocate($image, 0, 0, 255);
imagefilledrectangle($image, 0, 0, 200, 200, $blue);

$red = imagecolorallocatealpha($image, 255, 0, 0, 50);
imagefilledellipse($image, 100, 100, 200, 100, $red);

header(&quot;Content-Type: image/png&quot;);

imagepng($image);</code></pre></div>



<figure class="wp-block-image size-full"><img decoding="async" width="1000" height="625" src="https://nabeshiblog.com/wp-content/uploads/2021/10/imagecolorallocatealpha.jpg" alt="" class="wp-image-151" srcset="https://nabeshiblog.com/wp-content/uploads/2021/10/imagecolorallocatealpha.jpg 1000w, https://nabeshiblog.com/wp-content/uploads/2021/10/imagecolorallocatealpha-300x188.jpg 300w, https://nabeshiblog.com/wp-content/uploads/2021/10/imagecolorallocatealpha-768x480.jpg 768w" sizes="(max-width: 1000px) 100vw, 1000px" /></figure>



<p>透過した楕円部分が青と重なって色が混ざっていますね。<br>今度はアルファブレンディングをオフにして実行するとどのようになるか確認してみましょう。</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-php" data-lang="PHP"><code>$image = imagecreatetruecolor(200, 200);
imagealphablending($image, false);

$blue = imagecolorallocate($image, 0, 0, 255);
imagefilledrectangle($image, 0, 0, 200, 200, $blue);

$red = imagecolorallocatealpha($image, 255, 0, 0, 50);
imagefilledellipse($image, 100, 100, 200, 100, $red);

header(&quot;Content-Type: image/png&quot;);

imagepng($image);</code></pre></div>



<figure class="wp-block-image size-full"><img decoding="async" width="1000" height="625" src="https://nabeshiblog.com/wp-content/uploads/2021/10/imagealphablending.jpg" alt="" class="wp-image-152" srcset="https://nabeshiblog.com/wp-content/uploads/2021/10/imagealphablending.jpg 1000w, https://nabeshiblog.com/wp-content/uploads/2021/10/imagealphablending-300x188.jpg 300w, https://nabeshiblog.com/wp-content/uploads/2021/10/imagealphablending-768x480.jpg 768w" sizes="(max-width: 1000px) 100vw, 1000px" /></figure>



<p>アルファブレンディングをオフにしているので透過した部分が背景と混ざった色になっていないですね。<br>imagealphablending関数を使用するとこのような違いが出てくるので押さえておきましょう。</p>



<h2 class="wp-block-heading"><span id="toc3">色を特定する</span></h2>



<p>画像内の特定の点の色を調べるには<strong>imagecolorat関数</strong>と<strong>imagecolorsforindex関数</strong>を使用します。</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-php" data-lang="PHP"><code>imagecolorat(GDImage, x, y);
imagecolorsforindex(GDImage, color);</code></pre></div>



<p>imagecolorat関数で指定した座標の色のインデックスを取得し、その値をimagecolorsforindex関数に渡すことでred、green、blue、aplphaのそれぞれの値を連想配列で取得できます。</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-php" data-lang="PHP"><code>$image = imagecreatetruecolor(200, 200);

$blue = imagecolorallocate($image, 0, 0, 255);
imagefilledrectangle($image, 0, 0, 200, 200, $blue);

$point = imagecolorat($image, 100, 100);

print_r(imagecolorsforindex($image, $point));</code></pre></div>



<p>blueのバリューが255になっていれば指定した座標の色を取得できています。</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>PHP グラフィック処理 ~画像の拡大縮小~</title>
		<link>https://nabeshiblog.com/php-graphic4/</link>
		
		<dc:creator><![CDATA[なべし]]></dc:creator>
		<pubDate>Wed, 06 Oct 2021 09:27:11 +0000</pubDate>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[プログラミング]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[php技術者認定試験]]></category>
		<category><![CDATA[資格]]></category>
		<guid isPermaLink="false">https://nabeshiblog.com/?p=124</guid>

					<description><![CDATA[今回は画像のサイズの変更方法について解説していきます。画像のサイズの変更方法は２通りあります。1つ目はimagecopyresized関数を使用する方法。2つ目はimagecopyresampled関数を使用する方法です [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>今回は画像のサイズの変更方法について解説していきます。<br>画像のサイズの変更方法は２通りあります。<br>1つ目は<strong>imagecopyresized関数</strong>を使用する方法。<br>2つ目は<strong>imagecopyresampled関数</strong>を使用する方法です。<br>それぞれ特徴があるのでその特徴をしっかり押さえておきましょう。</p>



<h2 class="wp-block-heading"><span id="toc1">imagecopyresized関数</span></h2>



<p><strong>iamgecopyresized関数</strong>は指定した画像の矩形部分をコピーしサイズを変更することができます。<br>処理は高速ですがリサイズ後の画像の角がギザギザになります。</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-php" data-lang="PHP"><code>imagecopyresized($dst_image, $src_image, $dst_x, $dst_y, $src_x, $src_y, $dst_width, $dst_height, $src_width, $src_height);</code></pre></div>



<p>この後解説するimagecopyresampled関数も引数に渡せる値は同じです。</p>



<p>$dst_imageはコピー先となるGDImageインスタンスを渡します。</p>



<p>$src_imageには拡大/縮小したいimagecreatefrompng関数などで読み込んだ画像のGDImageインスタンスを渡してください。<br>簡単にいうとコピー元です。</p>



<p>$dst_xと$dst_yはコピー先の座標、$src_xと$src_yはコピー元の座標を渡します。</p>



<p>$dst_widthと$dst_heighにはコピー先の画像の幅と高さ、$src_widthと$src_heightにはコピー元の画像の幅と高さを渡してください。</p>



<p>画像の幅を取得するには<strong>imagesx関数</strong>、高さを取得するには<strong>imagesy関数</strong>を使用します。<br>取得したいGDImageインスタンスを渡すとその幅や高さを取得できます。</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-php" data-lang="PHP"><code>$soruce = imagecreatefrompng(&#39;画像までのパス&#39;);
$width = imagesx($source);
$height = imagesy($source);
echo &quot;width: {$width}, height: {$height}&quot;;</code></pre></div>



<p>今回は<a href="https://svgporn.com/#search=php">SVGPORN</a>でダウンロードしてきたPHPのロゴ画像を縮小していきます。</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-php" data-lang="PHP"><code>// 画像読み込み
$source = imagecreatefrompng(&#39;./php.png&#39;);

// 元画像のサイズを取得
$originalWidth = imagesx($source);
$originalHeight = imagesy($source);

// コピー後のサイズを算出
$destinationWidth = $originalWidth / 2;
$destinationHeight = $originalHeight / 2;

$destination = imagecreate($destinationWidth, $destinationHeight);

// 1/4サイズに縮小
imagecopyresized($destination, $source, 0, 0, 0, 0, $destinationWidth, $destinationHeight, $originalWidth, $originalHeight);

header(&quot;Content-Type: image/png&quot;);
imagepng($destination);</code></pre></div>



<p>元のサイズが256×135だったので縮小して128×67.5になりました。</p>



<figure class="wp-block-image size-full"><img decoding="async" width="1000" height="625" src="https://nabeshiblog.com/wp-content/uploads/2021/10/imagecopyresized.jpg" alt="" class="wp-image-127" srcset="https://nabeshiblog.com/wp-content/uploads/2021/10/imagecopyresized.jpg 1000w, https://nabeshiblog.com/wp-content/uploads/2021/10/imagecopyresized-300x188.jpg 300w, https://nabeshiblog.com/wp-content/uploads/2021/10/imagecopyresized-768x480.jpg 768w" sizes="(max-width: 1000px) 100vw, 1000px" /></figure>



<h2 class="wp-block-heading"><span id="toc2">imagecopyresampled関数</span></h2>



<p><strong>imagecopyresampled関数</strong>はimagecopyresized関数に比べ処理は遅いですが、コピーした画像のピクセルを補間し滑らかにしてくれます。</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-php" data-lang="PHP"><code>// 画像読み込み
$source = imagecreatefrompng(&#39;./php.png&#39;);

// 元画像のサイズを取得
$originalWidth = imagesx($source);
$originalHeight = imagesy($source);

// コピー後のサイズを算出
$destinationWidth = $originalWidth / 2;
$destinationHeight = $originalHeight / 2;

$destination = imagecreate($destinationWidth, $destinationHeight);

// 1/4サイズに縮小
imagecopyresampled($destination, $source, 0, 0, 0, 0, $destinationWidth, $destinationHeight, $originalWidth, $originalHeight);

header(&quot;Content-Type: image/png&quot;);
imagepng($destination);</code></pre></div>



<p>今回は画像を縮小しただけなので画像の滑らかさはほとんど分かりませんでした。</p>



<figure class="wp-block-image size-full"><img decoding="async" width="1000" height="625" src="https://nabeshiblog.com/wp-content/uploads/2021/10/imagecopyresampled.jpg" alt="" class="wp-image-128" srcset="https://nabeshiblog.com/wp-content/uploads/2021/10/imagecopyresampled.jpg 1000w, https://nabeshiblog.com/wp-content/uploads/2021/10/imagecopyresampled-300x188.jpg 300w, https://nabeshiblog.com/wp-content/uploads/2021/10/imagecopyresampled-768x480.jpg 768w" sizes="(max-width: 1000px) 100vw, 1000px" /></figure>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>PHP グラフィック処理 ~図形を描画する~</title>
		<link>https://nabeshiblog.com/php-graphic3/</link>
		
		<dc:creator><![CDATA[なべし]]></dc:creator>
		<pubDate>Tue, 05 Oct 2021 13:20:29 +0000</pubDate>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[プログラミング]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[php技術者認定試験]]></category>
		<category><![CDATA[資格]]></category>
		<guid isPermaLink="false">https://nabeshiblog.com/?p=90</guid>

					<description><![CDATA[前回はPHPで作成した画像の中にテキストを表示するというものでした。今回は画像の中に図形を描画していきます。図形を描画する関数には、指定した色を枠だけに適用するものと塗りつぶすものがあります。filledというワードがつ [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>前回はPHPで作成した画像の中にテキストを表示するというものでした。<br>今回は画像の中に図形を描画していきます。<br>図形を描画する関数には、指定した色を<strong>枠だけに適用するもの</strong>と<strong>塗りつぶすもの</strong>があります。<br>filledというワードがついたら基本的に塗りつぶす描画関数だと思って問題ありません。</p>



<h2 class="wp-block-heading"><span id="toc1">直線を描画する</span></h2>



<p><strong>imageline関数</strong>は直線を描画します。</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-php" data-lang="PHP"><code>imageline(GDImage, start_x, start_y, end_x, end_y, color);</code></pre></div>



<p>作成した画像の左上を0として開始位置のx座標とy座標、終点位置のx座標とy座標を直線で結び、色をつけます。</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-php" data-lang="PHP"><code>$image = imagecreate(200, 200);

imagecolorallocate($image, 255, 255, 255);
$red = imagecolorallocate($image, 255, 0, 0);

imageline($image, 50, 50, 150, 150, $red);

header(&quot;Content-Type: image/png&quot;);

imagepng($image);</code></pre></div>



<figure class="wp-block-image size-full"><img decoding="async" width="1000" height="625" src="https://nabeshiblog.com/wp-content/uploads/2021/10/imageline.jpg" alt="" class="wp-image-94" srcset="https://nabeshiblog.com/wp-content/uploads/2021/10/imageline.jpg 1000w, https://nabeshiblog.com/wp-content/uploads/2021/10/imageline-300x188.jpg 300w, https://nabeshiblog.com/wp-content/uploads/2021/10/imageline-768x480.jpg 768w" sizes="(max-width: 1000px) 100vw, 1000px" /></figure>



<p><strong>imagedashedline関数</strong>を使用すると破線を描画します。<br>引数に渡せる値はimageline関数と同じです。<br>この関数は古いため線を装飾する場合は、imagesetstyle関数を使用した方が良いようです。</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-php" data-lang="PHP"><code>$image = imagecreate(200, 200);

imagecolorallocate($image, 255, 255, 255);
$red = imagecolorallocate($image, 255, 0, 0);

imagedashedline($image, 50, 50, 150, 150, $red);

header(&quot;Content-Type: image/png&quot;);

imagepng($image);</code></pre></div>



<figure class="wp-block-image size-full"><img decoding="async" width="1000" height="625" src="https://nabeshiblog.com/wp-content/uploads/2021/10/imagedashedline.jpg" alt="" class="wp-image-95" srcset="https://nabeshiblog.com/wp-content/uploads/2021/10/imagedashedline.jpg 1000w, https://nabeshiblog.com/wp-content/uploads/2021/10/imagedashedline-300x188.jpg 300w, https://nabeshiblog.com/wp-content/uploads/2021/10/imagedashedline-768x480.jpg 768w" sizes="(max-width: 1000px) 100vw, 1000px" /></figure>



<h2 class="wp-block-heading"><span id="toc2">矩形を描画する</span></h2>



<p>矩形を描画するには<strong>imagerectangle関数</strong>か<strong>imagefilledrectangle関数</strong>のどちらかを使用します。<br>引数に渡せる値は同じです。</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-php" data-lang="PHP"><code>imagerectangle(GDImage, top_left_x, top_left_y, bottom_right_x, bottom_right_y, color);
imagefilledrectangle(GDImage, top_left_x, top_left_y, bottom_right_x, bottom_right_y, color);</code></pre></div>



<p>左上と右下に点を取り描画します。<br>まずはimagerectangle関数を見てみましょう。</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-php" data-lang="PHP"><code>$image = imagecreate(200, 200);

imagecolorallocate($image, 255, 255, 255);
$red = imagecolorallocate($image, 255, 0, 0);

imagerectangle($image, 50, 50, 150, 150, $red);

header(&quot;Content-Type: image/png&quot;);

imagepng($image);</code></pre></div>



<figure class="wp-block-image size-full"><img decoding="async" width="1000" height="625" src="https://nabeshiblog.com/wp-content/uploads/2021/10/imagerectangle.jpg" alt="" class="wp-image-97" srcset="https://nabeshiblog.com/wp-content/uploads/2021/10/imagerectangle.jpg 1000w, https://nabeshiblog.com/wp-content/uploads/2021/10/imagerectangle-300x188.jpg 300w, https://nabeshiblog.com/wp-content/uploads/2021/10/imagerectangle-768x480.jpg 768w" sizes="(max-width: 1000px) 100vw, 1000px" /></figure>



<p>imagefilled関数はこの枠線を含む内側を塗りつぶします。</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-php" data-lang="PHP"><code>$image = imagecreate(200, 200);

imagecolorallocate($image, 255, 255, 255);
$red = imagecolorallocate($image, 255, 0, 0);

imagefilledrectangle($image, 50, 50, 150, 150, $red);

header(&quot;Content-Type: image/png&quot;);

imagepng($image);</code></pre></div>



<figure class="wp-block-image size-full"><img decoding="async" width="1000" height="625" src="https://nabeshiblog.com/wp-content/uploads/2021/10/imagefilledrectangle.jpg" alt="" class="wp-image-98" srcset="https://nabeshiblog.com/wp-content/uploads/2021/10/imagefilledrectangle.jpg 1000w, https://nabeshiblog.com/wp-content/uploads/2021/10/imagefilledrectangle-300x188.jpg 300w, https://nabeshiblog.com/wp-content/uploads/2021/10/imagefilledrectangle-768x480.jpg 768w" sizes="(max-width: 1000px) 100vw, 1000px" /></figure>



<h2 class="wp-block-heading"><span id="toc3">多角形を描画する</span></h2>



<p>多角形を描画するには<strong>imagepolygon関数</strong>か<strong>imagefilledpolygon関数</strong>のどちらかを使用します。<br><meta charset="utf-8">引数に渡せる値は同じです。</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-php" data-lang="PHP"><code>imagepolygon(GDImage, points, number, color);
imagefilledpolygon(GDImage, points, number, color);</code></pre></div>



<p>pointsにはx座標とy座標の配列を渡します。<br>例えば、(50, 50)、(50, 150)、(150,150)この3点の座標をpointsに渡すには以下のように配列にして渡す必要があります。</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-php" data-lang="PHP"><code>[50, 50, 50,150, 150, 150];</code></pre></div>



<p>numberは描画する多角形の頂点の数を指定します。<br>３以上の値を指定する必要があります。<br>numberにはpointsの要素数を2で割った数を渡すようにしましょう。</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-php" data-lang="PHP"><code>$image = imagecreate(200, 200);

imagecolorallocate($image, 255, 255, 255);
$red = imagecolorallocate($image, 255, 0, 0);

$points = [50, 50, 50, 150, 150, 150];
imagepolygon($image, $points, count($points) / 2, $red);

header(&quot;Content-Type: image/png&quot;);

imagepng($image);</code></pre></div>



<figure class="wp-block-image size-full"><img decoding="async" width="1000" height="625" src="https://nabeshiblog.com/wp-content/uploads/2021/10/imagepolygon.jpg" alt="" class="wp-image-100" srcset="https://nabeshiblog.com/wp-content/uploads/2021/10/imagepolygon.jpg 1000w, https://nabeshiblog.com/wp-content/uploads/2021/10/imagepolygon-300x188.jpg 300w, https://nabeshiblog.com/wp-content/uploads/2021/10/imagepolygon-768x480.jpg 768w" sizes="(max-width: 1000px) 100vw, 1000px" /></figure>



<p>imagefilledpolygon関数を使用するとこのようになります。</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-php" data-lang="PHP"><code>$image = imagecreate(200, 200);

imagecolorallocate($image, 255, 255, 255);
$red = imagecolorallocate($image, 255, 0, 0);

$points = [50, 50, 50, 150, 150, 150];
imagefilledpolygon($image, $points, count($points) / 2, $red);

header(&quot;Content-Type: image/png&quot;);

imagepng($image);</code></pre></div>



<figure class="wp-block-image size-full"><img decoding="async" width="1000" height="625" src="https://nabeshiblog.com/wp-content/uploads/2021/10/imagefilledpolygon.jpg" alt="" class="wp-image-102" srcset="https://nabeshiblog.com/wp-content/uploads/2021/10/imagefilledpolygon.jpg 1000w, https://nabeshiblog.com/wp-content/uploads/2021/10/imagefilledpolygon-300x188.jpg 300w, https://nabeshiblog.com/wp-content/uploads/2021/10/imagefilledpolygon-768x480.jpg 768w" sizes="(max-width: 1000px) 100vw, 1000px" /></figure>



<h2 class="wp-block-heading"><span id="toc4">弧（円）を描画する</span></h2>



<p><meta charset="utf-8">弧（円）を描画するには<strong>imagearc関数</strong>か<strong>imagefilledarc関数</strong>を使用します。<br>引数に渡せる値はstyleを除いて同じです。</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-php" data-lang="PHP"><code>imagearc(GDImage, center_x, center_y, width, height, start_deg, end_deg, color);
imagefilledarc(GDImage, center_x, center_y, width, height, start_deg, end_deg, color, style);</code></pre></div>



<p>引数に渡す値は円の中心の座標、幅、高さ、弧の開始位置と終了位置です。<br>start_degに0を渡すと3時の方向から時計回りにend_degまでの弧を描画します。</p>



<p>imagearc関数で弧を描画するとこのようになります。</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-php" data-lang="PHP"><code>$image = imagecreate(200, 200);

imagecolorallocate($image, 255, 255, 255);
$red = imagecolorallocate($image, 255, 0, 0);

imagearc($image, 100, 100, 200, 200, 0, 90, $red);

header(&quot;Content-Type: image/png&quot;);

imagepng($image);</code></pre></div>



<figure class="wp-block-image size-full"><img decoding="async" width="1000" height="625" src="https://nabeshiblog.com/wp-content/uploads/2021/10/imagearc.jpg" alt="" class="wp-image-106" srcset="https://nabeshiblog.com/wp-content/uploads/2021/10/imagearc.jpg 1000w, https://nabeshiblog.com/wp-content/uploads/2021/10/imagearc-300x188.jpg 300w, https://nabeshiblog.com/wp-content/uploads/2021/10/imagearc-768x480.jpg 768w" sizes="(max-width: 1000px) 100vw, 1000px" /></figure>



<p>imagefilledarc関数は引数の最後に描画するstyleを渡します。<br>styleには<strong>IMG_ARC_PIE</strong>、<meta charset="utf-8"><strong>IMG_ARC_CHORD</strong>、<meta charset="utf-8"><strong>IMG_ARC_NOFILL</strong>、<meta charset="utf-8"><strong>IMG_ARC_EDGED</strong>のいずれかの値を渡します。</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-php" data-lang="PHP"><code>$image = imagecreate(200, 200);

imagecolorallocate($image, 255, 255, 255);
$red = imagecolorallocate($image, 255, 0, 0);

imagefilledarc($image, 100, 100, 200, 200, 0, 90, $red, IMG_ARC_PIE);

header(&quot;Content-Type: image/png&quot;);

imagepng($image);</code></pre></div>



<figure class="wp-block-image size-full"><img decoding="async" width="1000" height="625" src="https://nabeshiblog.com/wp-content/uploads/2021/10/imagefilledarc.png" alt="" class="wp-image-108" srcset="https://nabeshiblog.com/wp-content/uploads/2021/10/imagefilledarc.png 1000w, https://nabeshiblog.com/wp-content/uploads/2021/10/imagefilledarc-300x188.png 300w, https://nabeshiblog.com/wp-content/uploads/2021/10/imagefilledarc-768x480.png 768w" sizes="(max-width: 1000px) 100vw, 1000px" /></figure>



<h2 class="wp-block-heading"><span id="toc5">楕円を描画する</span></h2>



<p>楕円を描画するには<strong>imageellipse関数</strong>か<strong>imagefilledellipse関数</strong>を使用します。<br>引数に渡せる値は同じです。</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-php" data-lang="PHP"><code>iamgeellipse(GDImage, center_x, center_y, width, height, color);
imagefilledellipse(GDImage, center_x, center_y, width, height, color);</code></pre></div>



<p>center_xとcenter_yには中心の座標、widthとheightにはそれぞれ幅と高さを渡してください。</p>



<p>imagearc関数でも楕円を描画することができますが、コードを見直した時の観点から考えると描画する図形に合わせた関数を使用するのが望ましいです。</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-php" data-lang="PHP"><code>$image = imagecreate(200, 200);

imagecolorallocate($image, 255, 255, 255);
$red = imagecolorallocate($image, 255, 0, 0);

imageellipse($image, 100, 100, 200, 100, $red);

header(&quot;Content-Type: image/png&quot;);

imagepng($image);</code></pre></div>



<figure class="wp-block-image size-full"><img decoding="async" width="1000" height="625" src="https://nabeshiblog.com/wp-content/uploads/2021/10/imageellipse.jpg" alt="" class="wp-image-147" srcset="https://nabeshiblog.com/wp-content/uploads/2021/10/imageellipse.jpg 1000w, https://nabeshiblog.com/wp-content/uploads/2021/10/imageellipse-300x188.jpg 300w, https://nabeshiblog.com/wp-content/uploads/2021/10/imageellipse-768x480.jpg 768w" sizes="(max-width: 1000px) 100vw, 1000px" /></figure>



<p>imagefilledellipse関数を使用するとこのようになります。</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-php" data-lang="PHP"><code>$image = imagecreate(200, 200);

imagecolorallocate($image, 255, 255, 255);
$red = imagecolorallocate($image, 255, 0, 0);

imagefilledellipse($image, 100, 100, 200, 100, $red);

header(&quot;Content-Type: image/png&quot;);

imagepng($image);</code></pre></div>



<figure class="wp-block-image size-full"><img decoding="async" width="1000" height="625" src="https://nabeshiblog.com/wp-content/uploads/2021/10/imagefilledellipse.jpg" alt="" class="wp-image-148" srcset="https://nabeshiblog.com/wp-content/uploads/2021/10/imagefilledellipse.jpg 1000w, https://nabeshiblog.com/wp-content/uploads/2021/10/imagefilledellipse-300x188.jpg 300w, https://nabeshiblog.com/wp-content/uploads/2021/10/imagefilledellipse-768x480.jpg 768w" sizes="(max-width: 1000px) 100vw, 1000px" /></figure>



<h2 class="wp-block-heading"><span id="toc6">画像の回転</span></h2>



<p>画像を回転させるには<strong>imagerotate関数</strong>を使用します。<br>この関数は描画した図形だけを回転させるのではなく、画像そのものを回転させます。</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-php" data-lang="PHP"><code>imagerotate($GDImage, deg, color);</code></pre></div>



<p>degに回転させる角度を渡します。</p>



<p>PHPで画像を作成すると、アートボードの上にimagecreate関数指定したサイズの画像が重なっているようなイメージになります。<br>例えば、imagecreate関数で幅200、縦200の画像を作成するとアートボードのサイズも<meta charset="utf-8">幅200、縦200のようになるようです。<br>画像を常に覆えるようにアートボードのサイズが変動してくれるみたいです。<br>画像を回転させるとアートボードと画像の重なり合って内部部分が生じます。<br>この時の色を第三引数のcolorに渡します。</p>



<p>この関数の返り値を画像出力関数（imagepng関数など）に渡さないとWeb上の画像は回転していないので注意が必要です。</p>



<p>imagerotate関数で画像を回転させるとこのようになります。</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-php" data-lang="PHP"><code>$image = imagecreate(200, 200);

imagecolorallocate($image, 255, 255, 255);
$red = imagecolorallocate($image, 255, 0, 0);
$blue = imagecolorallocate($image, 0, 0, 255);

imagefilledrectangle($image, 50, 50, 150, 150, $red);

$rotate = imagerotate($image, 45, $blue, true);

header(&quot;Content-Type: image/png&quot;);

imagepng($rotate);</code></pre></div>



<figure class="wp-block-image size-full"><img decoding="async" width="1000" height="625" src="https://nabeshiblog.com/wp-content/uploads/2021/10/imagerotate.jpg" alt="" class="wp-image-110" srcset="https://nabeshiblog.com/wp-content/uploads/2021/10/imagerotate.jpg 1000w, https://nabeshiblog.com/wp-content/uploads/2021/10/imagerotate-300x188.jpg 300w, https://nabeshiblog.com/wp-content/uploads/2021/10/imagerotate-768x480.jpg 768w" sizes="(max-width: 1000px) 100vw, 1000px" /></figure>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>PHP グラフィック処理 ~テキストを描画する~</title>
		<link>https://nabeshiblog.com/php-graphic2/</link>
		
		<dc:creator><![CDATA[なべし]]></dc:creator>
		<pubDate>Tue, 05 Oct 2021 02:45:16 +0000</pubDate>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[プログラミング]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[php技術者認定試験]]></category>
		<category><![CDATA[資格]]></category>
		<guid isPermaLink="false">https://nabeshiblog.com/?p=73</guid>

					<description><![CDATA[前回は画像のサイズと色を指定して出力するだけでしたが、今回は作成した画像の中にテキストを描画する方法を紹介していきます。 テキストを描画する テキストを描画するにはimagestring関数かimagettftext関数 [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>前回は画像のサイズと色を指定して出力するだけでしたが、今回は作成した画像の中にテキストを描画する方法を紹介していきます。</p>



<h2 class="wp-block-heading"><span id="toc1">テキストを描画する</span></h2>



<p>テキストを描画するには<strong>imagestring関数</strong>か<strong>imagettftext関数</strong>のいずれかを使用します。</p>



<h3 class="wp-block-heading"><span id="toc2">imagestring関数</span></h3>



<div class="hcb_wrap"><pre class="prism line-numbers lang-php" data-lang="PHP"><code>imagestring(GDImage, font_id, x, y, text, color);</code></pre></div>



<p>GDImageはimagecreate関数などの返り値を渡してください。</p>



<p>font_idには1〜5の数値を指定します。<br>数値が5に近づくほど描画するフォントサイズが大きくなります。<br><strong>imageloadfont関数</strong>でユーザー定義のビットマップを読み込んで独自のfont_idを使えるようにする方法もあります。<br>バイナリ形式のデータなので読み込むコンピュータに依存してしまいます。</p>



<p>imagecreate関数などで作成した画像の左上を0として、文字を表示する位置をxとyに渡します。</p>



<p>textには表示する文字を渡します。<br>マルチバイトには対応していないので日本語を渡すと文字化けします。</p>



<p>colorは<strong>imagecolorallocate関数</strong>の返り値を渡します。<br>2回目以降のimagecolorallocate関数の呼び出しは変数に代入しておくと使いやすいです。</p>



<p>白色の画像の中に黒色のDEMOという文字を表示して出力してみます。</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-php" data-lang="PHP"><code>$image = imagecreate(200, 200);

imagecolorallocate($image, 255, 255, 255);

$textColor = imagecolorallocate($image, 0, 0, 0);

imagestring($image, 5, 50, 50, &quot;DEMO&quot;, $textColor);

header(&quot;Content-Type: image/png&quot;);

imagepng($image);</code></pre></div>



<p>このようになっていれば正解です。</p>



<figure class="wp-block-image size-full"><img decoding="async" width="1000" height="625" src="https://nabeshiblog.com/wp-content/uploads/2021/10/imagestring.jpg" alt="" class="wp-image-76" srcset="https://nabeshiblog.com/wp-content/uploads/2021/10/imagestring.jpg 1000w, https://nabeshiblog.com/wp-content/uploads/2021/10/imagestring-300x188.jpg 300w, https://nabeshiblog.com/wp-content/uploads/2021/10/imagestring-768x480.jpg 768w" sizes="(max-width: 1000px) 100vw, 1000px" /></figure>



<h3 class="wp-block-heading"><span id="toc3">imagettftext関数</span></h3>



<div class="hcb_wrap"><pre class="prism line-numbers lang-php" data-lang="PHP"><code>imagettftext(GDImage, size, angle, x, y, color, path, text);</code></pre></div>



<p><strong>imagettftext関数</strong>はimagestring関数より細かい設定が可能です。<br>imagestring関数ではフォントサイズを1〜5で設定していましたが、imagettftext関数はピクセルで指定できます。<br>他にも表示する文字の角度を変えたり、使用するフォントを選べます。<br>日本語に対応しているフォントであれば日本語を表示することも可能です。<br>imagettftext関数はデフォルトでアンチエイリアス処理が施されているのが特徴的です。</p>



<p>スクリプトと同じディレクトリにあるDIN Bold.otfのフォントでテキストを縦に表示しようとすると以下のようなコードになります。</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-php" data-lang="PHP"><code>$image = imagecreate(200, 200);

imagecolorallocate($image, 255, 255, 255);

$textColor = imagecolorallocate($image, 0, 0, 0);

imagettftext($image, 20, 270, 50, 50, $textColor, &quot;./DIN Bold.otf&quot;, &quot;DEMO&quot;);

header(&quot;Content-Type: image/png&quot;);

imagepng($image);</code></pre></div>



<p>imagettftext関数を使用するとWebフォントを使用できるのが強いですね。<br>このようになっていれば正常に動作しています。</p>



<figure class="wp-block-image size-full"><img decoding="async" width="1000" height="625" src="https://nabeshiblog.com/wp-content/uploads/2021/10/imagettftext.jpg" alt="" class="wp-image-84" srcset="https://nabeshiblog.com/wp-content/uploads/2021/10/imagettftext.jpg 1000w, https://nabeshiblog.com/wp-content/uploads/2021/10/imagettftext-300x188.jpg 300w, https://nabeshiblog.com/wp-content/uploads/2021/10/imagettftext-768x480.jpg 768w" sizes="(max-width: 1000px) 100vw, 1000px" /></figure>



<h2 class="wp-block-heading"><span id="toc4">テキストの大きさを取得する</span></h2>



<p>フォントサイズではなく、テキストを表示する領域の大きさを取得するには<strong>imagettfbbox関数</strong>を使用します。</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-php" data-lang="PHP"><code>imagettfbbox($size, $angle, $font, $text);</code></pre></div>



<div class="wp-block-cocoon-blocks-column-2 column-wrap column-2 column-2-2-1-1 layout-box">
<div class="wp-block-cocoon-blocks-column-left column-left">
<p>返り値は要素数が8の配列形式で返される。</p>
</div>



<div class="wp-block-cocoon-blocks-column-right column-right">
<figure class="wp-block-table is-style-stripes"><table><tbody><tr><td>キー</td><td>内容</td></tr><tr><td>0</td><td>左下のX座標</td></tr><tr><td>1</td><td>左下のY座標</td></tr><tr><td>2</td><td>右下のX座標</td></tr><tr><td>3</td><td>右下のY座標</td></tr><tr><td>4</td><td>右上のX座標</td></tr><tr><td>5</td><td>右上のY座標</td></tr><tr><td>6</td><td>左上のX座標</td></tr><tr><td>7</td><td>左上のY座標</td></tr></tbody></table></figure>
</div>
</div>



<p>テキストの表示領域を計算するには、</p>



<ul class="wp-block-list"><li>右下のX座標から左下のX座標を引いた絶対値</li><li>右上のY座標から右下のY座標を引いた絶対値</li></ul>



<p>で求められます。</p>



<h2 class="wp-block-heading"><span id="toc5">まとめ</span></h2>



<ul class="wp-block-list"><li>画像にテキストを描画する方法として<strong>imagestring関数</strong>と<strong>imagettftext関数</strong>がある</li><li>imagestring関数は1〜5の間でフォントサイズを決定する<br>imageloadfont関数でユーザー定義のフォントを読み込むことができるが、マシン依存してしまう</li><li>imagettftext関数はフォントサイズをピクセルで指定できる<br>また、表示するテキストの角度を変えたり、サーバーにあるフォントを読み込んでテキストのフォントを変更することができる</li><li>テキストの表示領域サイズを求めるには<strong>imagettfbox関数</strong>を使用する</li></ul>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
