رفع خطای آپلود فایل در وردپرس
یکی از خطاهایی که هنگام آپلود تصویر یا فایل در وردپرس ممکن است نمایش دهد خطای زیر است:
Post-processing of the image failed likely because the server is busy or does not have enough resources. Uploading a smaller image may help. Suggested maximum size is 2500 pixels.
پردازش پس از تصویر احتمالاً انجام نشد زیرا سرور مشغول است یا منابع کافی ندارد. آپلود یک تصویر کوچکتر ممکن است کمک کند. حداکثر اندازه پیشنهادی 2500 پیکسل است.
جای نگرانی نیست چند راهکار برای رفع آن وجود دارد:
1- وارد هاست خود شود . سیپنل را باز کنید و روی گزینه selector php کلیک کنید در این قسمت وارد تب Option شوید و آیتم memory_limit را افزایش دهید.
2- سایت را رفرش کنید و فایل خود را آپلود نمایید .
در صورتی که مشکل حل نشد ، این موارد را نیز اعمال کنید.
1- نام فایل خود را تغییر دهید.
2- از مرورگر دیگری استفاده کنید.
3- کش مرورگر خود را پاک کنید.
مجدد تست کنید در صورتی که هنوز مشکل پابرجاست کد زیر را در فایل فانکشن سایت خود کپی کنید.
add_filter( 'big_image_size_threshold', '__return_false' );
خوب بهتره درست شده باشه با این اقدامات ، اما اگر درست نشد جای نگرانی نیست .
به فایل فانکشن خود کد زیر را اضافه کنید.
add_filter('wp_image_editors', function($editors) {
return ['WP_Image_Editor_GD', 'WP_Image_Editor_Imagick'];
})
maximum file upload size را نیز از قسمت selector php -option tab افزایش دهید.
مطمئن شوید هاست شما دچار محدودیت استفاده از منابع نشده باشد.
ورژن php را تغییر دهید .
برای تست قالب سایت خود را به یکی از قالب های پیشفرض وردپرس تغییر دهید و آپلود را انجام دهید تا مطمئن شوید مشکل از سمت قالب نیست.
تمام راهکار بالا به صورت انگلیسی و مفصل در زیر اومده من به زبان ساده و سریع براتون نوشتم . میدونم الان دوست دارید زودتر تست کنید و مشکل حل بشه ، لطفا اگر راهکار دیگه ایی امتحان کردید و جواب داده برام کامنت کنید.
موفق باشید
Occasionally, you might see the following error when uploading an image to the Media Library. The issue can also occur when uploading an image in a Gutenberg block, or page builder image widget or image area, etc.:
“Post-processing of the image failed likely because the server is busy or does not have enough resources. Uploaded a smaller image may help. Suggest maximum size is 2500 pixels.”
The error may occur even when the image being uploaded is considerably smaller than 2500px.
The error is related to how WordPress 5.3+ handles uploaded images with very large dimensions.
It is not uncommon for users to upload images directly off a camera. Any digital camera with a sensor over 6-megapixels (MP) will commonly yield images over 2500 pixels on the long edge. These images are much larger resolution that commonly needed for the web. Even a new 2K monitor’s full width is only 2560 pixels. A 4K monitor has a width of 3840 pixels. The most common screen resolutions for your website visitors are much, much smaller. So, when uploading an image over 2500 pixels on the longest dimension, WordPress will attempt to reduce the image to ~2500 pixels and save that version as the “Full” sized image version.
If that process was flawless, you probably wouldn’t be reading this post. So, how to fix the error:
Basic Troubleshooting
Before venturing on too far, double check some of the easiest potential causes. These probably won’t fix the issue, but you should get them out of the way just in case:
- Is your image larger that 2500 pixels on the long edge? If so, try reducing its size prior to upload.
- Try the upload in a different web browser.
- Check your filename. Are there any odd characters there, or is it just plain alphanumeric (A-Z/a-z and 0-9) with perhaps underlines or hyphens? On a side note, generally I prefer rename files to use filenames that are representative of the image’s usage context and content, e.g., header-my-page-name.jpg for the header image of a given page, footer-background.jpg for a footer background (go figure), or about-mr-lastname.jpg for a headshot on an About page. No filenames right off the camera, no odd unicode characters, no random characters carried over from other usages or file systems.
- Try peforming a hard refresh for the edit page in question (where the editor is shown, not the public, published page). Typically, a hard refresh would be Control + F5 in Chrome, Control + Shift + R in Firefox or Edge, Command + R in Safari.
- Try emptying your web browser’s cache at least for the site in question.
Common Fixes
- Bypass the check for large images. This is the solution that tends to work for me. Technically, it’s a workaround and not a fix. Add the following to the functions.php of your WordPress theme or child theme:
add_filter( 'big_image_size_threshold', '__return_false' );
- Install and activate the WordPress plugin “Disable ‘BIG Image’ Threshold” plugin. This plugin basically implements the above fix and may be more convenient for some folks.
When That Doesn’t Work: “Advanced” Troubleshooting
These are advanced in the sense of taking a bit more time, a bit more access, or a bit more potential impact on your site’s uptime.
- Use GD Library instead of ImageMagick for image processing. Add the following to your WordPress theme’s function.php file.
add_filter('wp_image_editors', function($editors) {
return ['WP_Image_Editor_GD', 'WP_Image_Editor_Imagick'];
}) - Verify your upload limit. The web server typically has each account set to a maximum file upload size, such as 10MB-128MB. Is the maximum file upload size set to something small, possibly in the vicinity of your large image’s size, e.g. 1-2MB? Generally, you will need to ask your host about this setting. You can try to set this value in your php.ini or .htaccess file, but in most cases any values set in those file will be overidden by the web server’s settings.
- Check your hosting account’s memory usage. If your account received high amounts of traffic or is involved (perhaps temporarily) in memory or CPU intensive activities such as backups, etc., it may be legimately running out of resources. In my experience this is seldomly the cause, but check.
- Swap your current PHP version. You may try to set the PHP version used on the site to a different version, for example PHP 7.3 instead of versions 7.2, 7.4 or 8.0, etc. Be careful in doing so in case the PHP version change causes issues with the proper function of the site. Ideally, test this only if you have direct access to the PHP setting, or have extremely responsive technical support from your host (that is, don’t file a ticket for a potentially site breaking PHP version change if the average turnaround time on tickets is more that a few minutes or whatever you consider acceptable downtime.).
- Swap to a basic WordPress theme and retest the upload process. It’s probably best to move your site to a staging server first and test there unless you are not yet in production.
Thoughts
I’d love to hear if you have solved this issue with another method. Drop me a comment below. Thanks!
مطلب در تاریخ 1 تیر 1401 به روز شده است
دیدگاه خود را ثبت کنید
تمایل دارید در گفتگوها شرکت کنید ؟در گفتگو ها شرکت کنید!