Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
WPB Cup
25 Million+
Websites using our plugins
16+
Years of WordPress experience
3000+
WordPress tutorials
by experts

WordPressで大きな画像をアップロードする方法

最近、あるユーザーからWordPressで大きな画像をアップロードする方法を尋ねられました。これは数年前まではよくある問題でしたが、最近のWordPressホスティングサービスプロバイダーのほとんどは、ほとんどの画像サイズに対応できる余裕のあるアップロード制限(多くの場合64MBから512MB)を提供しています。

実際、今日アップロードの制限にぶつかっているのであれば、そのような大きなファイルが本当に必要かどうか検討する価値があります。ほとんどの高品質ウェブ画像は5MB以下であり、適切な最適化によって、目に見える品質を失うことなく、さらに容量を減らすことができます。

ただし、非常に大きなファイル(高解像度の写真やデザインファイルなど)をアップロードする必要がある場合は、これらの制限を調整する方法をご紹介します。ただ、非常に大きな画像はサイトの表示速度を低下させ、ユーザーエクスペリエンスに影響を与える可能性があることを覚えておいてください。

Large File Size Error

WordPressの画像アップロード制限を理解する

もし「filename.jpgがこのサイトの最大アップロードサイズを超えています」というエラーメッセージが表示されたら、これはもう通常制限ではないことを知って驚くかもしれない。

実際、私たちがWordPressチュートリアルのテストに使用しているBluehostの共有ホスティングプランは、アップロード制限が512MBであり、それは彼らの最も高価なプランではありません。今日、他のほとんどのWordPressホスティングサービスは、通常64MBから512MBの間で、同様に寛大な制限を設定しています。

これを踏まえて、一般的な最適化されたウェブ画像はどのようなものか見てみましょう:

  • ブログ投稿画像:通常1~2MB
  • 製品写真2~3MB
  • ヘッダー画像:2-4MB
  • 写真ポートフォリオ:3-5MB

それでもアップロードの問題が発生する場合は、メディア ” 新規追加 ページで現在の制限を確認できます。これらの制限は、ホスティングサービス設定、メモリ制限の制約、またはサーバー構成設定によるものかもしれません。

maximum upload file size in WordPress

もしこれらのエラーのいずれかに遭遇しているのであれば、この投稿を参考にして、WordPressに大容量ファイルを簡単にアップロードできるようにしてください。

待って!🚨チュートリアルの続きに進む前に、まず画像最適化ツールを使って、画質を落とさずにファイルサイズを小さくすることを強くお勧めします。そうすることで、サイトの読み込みが速くなり、検索エンジンでの順位も上がります。

ステップバイステップの手順については、ウェブパフォーマンスのために画像を最適化する方法についてのガイドを参照してください。

WordPressで画像の最大アップロードサイズを増やす方法

WordPressで大きな画像やメディアファイルをアップロードしたい場合、WordPressの画像アップロードサイズの問題を解決する方法をご紹介します。

この方法では、WordPressにコードを追加する必要があります。WPCodeという無料のコード・スニペット・プラグインを使って安全に行いますので、やったことがない方もご安心ください。

WPCode

開始するには、無料のWPCodeプラグインをインストールし、有効化する必要があります。手順については、WordPressプラグインのインストール方法のチュートリアルを参照してください。

プラグインを有効化したら、WordPressダッシュボードからCode Snippets ” + Add Snippetページにアクセスします。

そこから、「カスタムコードの追加(新規スニペット)」設定の下にある「+カスタム・スニペットの追加」ボタンをクリックします。

Add new snippet

次に、コードのタイトルを追加し、下のコード・スニペットを「コード・プレビュー」ボックスに貼り付けます:

1
2
3
@ini_set( 'upload_max_size' , '256M' );
@ini_set( 'post_max_size', '256M');
@ini_set( 'max_execution_time', '300' );

256M」をご希望の最大ファイルサイズに置き換えてください。

画面右側のドロップダウンメニューから、コードタイプとして「PHP Snippet」を選択することをお忘れなく。

Paste code snippet into WPCode plugin

最後に、トグルを「非アクティブ」から「有効化」に切り替えるだけだ。

次に「スニペットを保存」ボタンをクリックする。

Activate and save your custom code snippet

このコードは、WordPressサイトのアップロード最大ファイルサイズ、投稿最大サイズ、最大実行時間の制限を増やそうとするものです。

とはいえ、この方法がすべてのサイトに有効とは限りません。その場合は、WordPressの最大ファイルアップロードサイズを増やす方法をご覧ください。

WordPressで大きな画像ファイルをアップロードする必要はあるのか?

画像サイズを整理してみよう。最適化されたウェブ画像のほとんどは、高品質の写真であっても5MB以下です。

たとえあなたが自分の作品を紹介したいプロの写真家であっても、ウェブ訪問者は印刷媒体と同じ解像度を必要としないことを覚えておいてください。適切に最適化された3MBの画像は、画面上では15MBの画像と同じように美しく見え、読み込みもはるかに速くなります。

大きな画像ファイルは、いくつかの方法であなたのサイトに影響を与えます:

  • ページ読み込み時間の短縮
  • ホスティングサービスのストレージ使用量の増加
  • 検索エンジンランキングの低下
  • モバイル端末でのユーザーエクスペリエンスの低さ

その代わり、こんなことをお勧めする:

  1. アップロードする前に画像を最適化することをお勧めします。
  2. 写真サイトには Envira Galleryのようなギャラリープラグインを使いましょう。画像の最適化を自動的に処理し、すべての端末で素早く読み込まれるレスポンシブなギャラリーを作成します。
  3. 大規模な画像ライブラリをお持ちの場合は、CDN(コンテンツデリバリーネットワーク)の利用をご検討ください。CDNは世界中のサーバーから画像を配信し、ロード時間とユーザー体験を向上させます。詳細な手順については、WordPress CDNソリューションのインストールとセットアップ方法のガイドをご覧ください。

以上、WordPressで大きな画像をアップロードする方法についてご紹介しました。また、WordPressの効果的なデザイン要素やドラッグ&ドロップで使えるWordPressページビルダーもぜひご覧ください。

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

Disclosure: Our content is reader-supported. This means if you click on some of our links, then we may earn a commission. See how WPBeginner is funded, why it matters, and how you can support us. Here's our editorial process.

アバター

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

The Ultimate WordPress Toolkit

Get FREE access to our toolkit - a collection of WordPress related products and resources that every professional should have!

Reader Interactions

13件のコメントLeave a Reply

  1. edizzz

    How do I put a button to download the image of the post like the wallpapers sites?

  2. Tyler Simonds

    Re-sizing images prior to upload is a pain–a whole ‘nother step that WordPress should do automatically.

  3. Brittney

    Hello,

    I tried using this code the 1st code into the functions folder, and now my website no longer works. I am getting “Parse error: syntax error, unexpected ‘@’ in ___” even after I have deleted the code and tried to update it back to normal. Any suggestions?

  4. Wali shah afridi

    i upload the above code but still the large image file does not upload in my block , kindly tell my that what i do know ??

  5. Chase

    I would like to clarify that making changes to functions.php files has no effect and that editing my .htaccess file causes an internal server error no matter how perfect I try to make the code. Should I be uploading large video files using another method? The main reason I want to upload the video is to share with a small group of people. I can’t upload it with YouTube, and therefore can embed into WordPress via YouTube because they claim a copyright on my music and the audio is automatically hushed. I need that specific audio track with my video, so YouTube is not an option. So I guess if I can’t solve this problem I need to either find a video hosting service that does not flag copyrighted material or try to host it myself, both of which are a bit off topic for this message board. I am assuming in am out of luck at this point.

  6. Chase

    Nothing works to upload large files on my GoDaddy WordPress multi-site account running the new version of php. I certainly can’t add directly though my WordPress media browser, so I upload the recommended way via FTP first. The problem is I can’t get the files from my ftp folder to the WordPress media browser. Very little relevant information is posted about the topic online. The recommended “Add from server” plugin does not work. The backup version does not work. The developer does not know. I have all my settings at the right levels in the cPanel configuration settings. I verified with GoDaddy three times. GoDaddy said I can’t do anything more on the hosting end and that it should work. Since the actual php.ini file is not accessible in GoDaddy, creating a new php5.ini or regular php.ini is recommended for GoDaddy servers, but this does not work for me. I can’t edit my actual php.ini file as the video shows. My files size a 150MB mp4 video file and can’t get it much smaller. I adjusted all of the WordPress settings for uploading large files and video files. This did not work. Does anybody know what to do? In the meantime, I am trying to find an another plugin that actually works.

    • WPBeginner Support

      You can simply paste the link of the uploaded file into your WordPress post editor and it will embed it for you. For example if you uploaded the file /wp-content/uploads/my-video.mp4 then you can just add http://example.com/wp-content/uploads/my-video.mp4 in a blog post (replace example.com with your own domain name) and WordPress will embed it for you. Give it a try let us know how it goes.

      Admin

  7. Lutaaya paddy

    thank you for this article it has worked for me . the code which is put in the .htaccess

  8. Penelope

    The reason I would like my max upload size increased is because I have a button that opens a URL link of my catalog for customers to download. This link is from my media folder in wordpress.
    If I use a link in a button, does this slow down my website? Do you have a recommendation on how to go about allowing viewers to view a pdf catalog without slowing down a website?

  9. Ankit Agarwal

    Though for photographers, using a template ( or theme ) that does not allows large image sizes is not understandable. And for rest of us using a plugin seems logical since we will never want to upload a 10 MB+ ( even that’s too high) for the fear of reducing speed. Other wise can there be another reason of uploading high res images?

  10. gary odom

    You call this WP for beginners but when you proceed to talk about things like php file and ftp client you assume a beginner knows of what you speak. I am sure there many that do, but do real beginners really know what you are talking about? Of course, you are entitled to do what you wish, but it certainly does not cater to true beginners that are still finding they way around the WP program. Many of us had our hosting service install WordPress for us so we are not acquainted with much of what you speak. i am anxious to learn but first I must understand the basics.

    • WPBeginner Support

      Thanks for the feedback. We do miss things occasionally, but you can always ask us to clarify in the comments. We will be happy to offer further explanation.

      PHP is the programming language in which WordPress is written. FTP client is a software that allows you to connect to your web server to edit and upload files on your shared hosting server. Take a look at our guide on how to use FTP to upload files to WordPress for beginners.

      Admin

  11. Rybird

    Very well written informative article.

Leave A Reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.