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

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

編集メモ: WPBeginner のパートナーリンクから手数料を得ています。手数料は編集者の意見や評価に影響を与えません。編集プロセスについて詳しく知る。

最近、あるユーザーからWordPressで大きな画像をアップロードする方法を尋ねられました。

WordPressで大きな画像をアップロードしようとすると、多くのユーザーにエラーが表示されます。これはファイルサイズの制限によるものです。

この投稿では、この問題を解決し、WordPressで大きな画像をアップロードする方法を紹介します。

Large File Size Error

なぜWordPressで大きな画像をアップロードできないのか?

WordPressホスティングサービスプロバイダーは、ファイルのアップロードサイズに合理的な制限を置く方法でサーバーを設定している可能性があります。

この制限は、メディア ” 新規追加ページで確認できます。

maximum upload file size in WordPress

アップロードしようとしているファイルよりも上限が小さい場合、次のようなエラーが表示されます:「ファイル名.jpgがこのサイトの最大アップロードサイズを超えています。

大きな画像ファイルのアップロードを妨げるもう一つの問題は、メモリ制限です。

初期設定では、WordPressサイトは適切な量のメモリを使用することが許可されています。スクリプトが長時間実行され、定義されたメモリ制限を使い果たすと、エラーが表示されます。

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

WordPressで画像のアップロードサイズを修正する

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

この方法では、WordPressにコードを追加する必要があります。WordPressにスニペットを貼り付ける方法については、こちらをご覧ください。

このコードをテーマのfunctions.phpファイルまたはコードスニペットプラグインに追加するだけです。

@ini_set( 'upload_max_size' , '64M' );
@ini_set( 'post_max_size', '64M');
@ini_set( 'max_execution_time', '300' );

WordPressのコードスニペットプラグインの最高峰であるWPCodeを使用して、このコードを追加することをお勧めします。テーマのfunctions.phpファイルを編集することなく、WordPressに安全かつ簡単にコードを追加することができます。

WPCode

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

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

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

Add a new custom code snippet in WPCode

次に、コードのタイトルを追加し、上記のコード・スニペットを「コード・プレビュー」ボックスに貼り付けます。画面右側のドロップダウンメニューから、コードタイプとして「PHP Snippet」を選択するのを忘れないでください。

Paste code snippet into WPCode plugin

最後に、トグルを’Inactive’から’Active’に切り替え、’Save Snippet’ボタンをクリックします。

Activate and save your custom code snippet

このコードは、WordPressサイトのアップロード最大ファイルサイズ、投稿最大サイズ、最大実行時間の制限を増やそうとするものです。ただし、WordPressサイトによっては動作しない場合があります。

その場合は、サイトのルート・フォルダーにある.htaccessファイルに次のコードを追加してみてください。

php_value upload_max_filesize 64M
php_value post_max_size 64M
php_value max_execution_time 300
php_value max_input_time 300

これらの方法が両方とも失敗した場合は、php.iniファイルを使ってこれらの値を調整してみてください。

php.iniファイルは、PHPが設定を定義するために使用する設定ファイルです。共有ホスティングサービスを使用しているユーザーは、通常メインファイルにアクセスできません。しかし、FTPクライアントを使用して、サイトのルートフォルダに空のphp.iniを作成することができます。

Creating a new file using FTP

php.iniファイルにこのコードを追加するだけです:

upload_max_filesize = 64M
post_max_size = 64M
max_execution_time = 300

詳しくは、WordPressで最大ファイルアップロードサイズを増やす方法をご覧ください。

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

画像はテキストよりも読み込みに時間がかかります。つまり、大きな画像ファイルがある場合、サイトの読み込みに時間がかかるということです。

検索エンジンは遅いサイトを嫌うため、巨大な画像を使用したページは検索結果で上位に表示されない可能性があります。これはトラフィックを犠牲にし、あなたのビジネスの目標に影響を与えるでしょう。

多くの写真サイトオーナーが、高画質の画像をサイトにアップロードしたいと望んでいることは理解しています。しかし、高画質の画像は、画質をそれほど落とすことなく、適度なファイルサイズに最適化することができます。

まず、ウェブ用に画像を最適化する方法を学ぶことをお勧めします。品質を落とすことなく、画像のファイルサイズを小さくすることができます。WordPressの管理エリアから画像の一括リサイズも可能です。

次に、Enviraギャラリーを使用してサイトに画像を表示する必要があります。Enviraは、サイトを遅くすることなく、画像ギャラリーを美しく表示します。驚くほど高速で美しく、すべての端末で動作します。WordPressのための最高のフォトギャラリープラグインだと信じています。

多くの人気サイトは、画像のような静的コンテンツを配信するためにCDNに依存しています。CDN(コンテンツデリバリーネットワーク)は、世界中にあるサーバーから画像を配信します。これにより、画像とサイトの他の部分が同時に読み込まれます。また、サイトのSEOやユーザーエクスペリエンスも向上します。

詳細な手順については、WordPress CDNソリューションのインストールとセットアップ方法のガイドを参照してください。

以上、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.

情報開示 私たちのコンテンツは読者支援型です。これは、あなたが私たちのリンクの一部をクリックした場合、私たちはコミッションを得ることができることを意味します。 WPBeginnerの資金源 をご覧ください。3$編集プロセスをご覧ください。

Avatar

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.

究極のWordPressツールキット

ツールキットへの無料アクセス - すべてのプロフェッショナルが持つべきWordPress関連製品とリソースのコレクション!

Reader Interactions

14件のコメント返信を残す

  1. Syed Balkhi says

    Hey WPBeginner readers,
    Did you know you can win exciting prizes by commenting on WPBeginner?
    Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
    You can get more details about the contest from here.
    Start sharing your thoughts below to stand a chance to win!

  2. Tyler Simonds says

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

  3. Brittney says

    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 says

    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 says

    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 says

    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.

  7. Penelope says

    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?

  8. Ankit Agarwal says

    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?

  9. gary odom says

    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.

返信を残す

コメントありがとうございます。すべてのコメントは私たちのコメントポリシーに従ってモデレートされ、あなたのメールアドレスが公開されることはありませんのでご留意ください。名前欄にキーワードを使用しないでください。個人的で有意義な会話をしましょう。