Support » Plugin: Regenerate Thumbnails » [Plugin: Regenerate Thumbnails] Failed to resize. Unknown failure reason.

  • Hi

    I’ve just migrated a website for a client and am having problems re-generating all the images i’ve moved over. I’m on MediaTemple Grid Server with PHP5, WordPress set to 96M of memory through WP-Config also. I’m not sure what the problem is, but i keep getting these errors, on the latest 2.2 and 2.1.2

    Debugging Information
    Total Images: 178
    Images Resized: 0
    Resize Failures: 8

    “Datarock2010_2_Photo_by_Tom_Oxley” (ID 8171) failed to resize. The error message was: Unknown failure reason.
    “PS_canb_29.04.11-[web]” (ID 8157) failed to resize. The error message was: Unknown failure reason.
    “Drums_A2-posters_NEW” (ID 8147) failed to resize. The error message was: Unknown failure reason.

Viewing 8 replies - 1 through 8 (of 8 total)
  • I’m getting the same error. In searching through the wp_postmeta table, it seems like the images that are failing to resize have blank _wp_attachment_metadata entries.

    It looks like this a:0:{}

    Seems the images that do have at least something for _wp_attachment_metadata resize just fine.

    NOTE: All the images (both successful resizes and failed resizes) have an entry for _wp_attached_file

    In my case, I migrated a website for a client using the WordPress import/export mechanism (as opposed to a MYSQL dump). After that was done, I noticed many of the images didn’t get copied over (even though I checked the box), so I used FTP to overwrite all the images from the old server to the new one.

    I tried to use Regenerate Thumbnails to re-create that metadata for each image, but for those images without a _wp_attachment_metadata entry, the plugin reports “resize failure: undefined

    Investigating with Firebug, the failed resizes are giving me a 500 internal server error under POST admin-ajax.php

    After combing through the database metadata entries (and trying a bunch of crap that didn’t work) I narrowed the issue down to those specific images that failed when running the Regenerate Thumbnails plugin.

    The reason some of the images failed to resize (and thus update their metadata) — and thus the root of our issue — was with the sheer size of the images my client was uploading. In this case, he was uploading super hi-res images that were 6 – 8 MB in size!

    The Regenerate Thumbnails plugin was successfully resizing all the smaller files, and then choking when it got to those huge ones — probably a PHP memory issue.

    Same issue

    To fix it, there are 2 options — resizing huge images ( >1 MB ) on the server side (using the Regen. Thumbnails plugin with more memory) or resizing huge images on your local computer (client side).

    To fix it on the server side (option 1), I had to bump up my max PHP memory limit (inside the php.ini file on my server) to 128 MB. Normally, it’s set to 32 MB or less.

    Really, that’s NOT a good idea, because it can potentially put an unnecessary load on your server and slow everyone down.

    A better idea would be to batch resize those huge images on your local computer all at once before you upload them to the new server.

    Here are a few options…
    1. PC instructions – Use Fotosizer or PictureTray
    2. Mac Instructions – Use Automator
    3. Photoshop Instructions – If you’re so inclined

    Resizing my huge images to a max size of 1024px, then uploading to the new server, then running Regen. Thumbnails worked for me with no errors. 🙂

    I had the same problem with the lack of metadata so I wrote a class to pull images from wp_posts, search for them on the filesystem to get their full path and then used the code below to regenerate all images with metadata and thumbnails for each size that is being used in the theme.

    The code below is pretty much straight from the example for wp_insert_attachment, with one difference: $fullpath = $this->search_for_file($image->post_name); this is the function in my class that finds the image in the uploads folder and returns its fullpath.

    Anyone who wants to download the class should email me, all you need to do is instantiate the class, passing the full path to your /wp-content/uploads/ folder

    [Code moderated as per the Forum Rules. Please use the pastebin]

    I was having this same problem. Unfortunately for me the problem was not with the sizes of my images. I was getting the error on every image… regardless of the size.

    In any case my problem was that the the Regen. Thumb plugin uses get_attached_file() to retrieve the filepath. The problem with this is that get_attached_file looks for a post metakey called _wp_attached_file which did not exist. (Not sure why this is the case… perhaps it was because all the content was imported from a non-wordpress blog). So to get the correct file path I did this:

    In the plugin regenerate-thumbnails.php file (line 352) I replaced

    $fullsizepath = get_attached_file( $image->ID );


    $meta = wp_get_attachment_metadata($image->ID, true);
    $file = $meta['file'];
    $uploads = wp_upload_dir();
    $fullsizepath = $uploads['basedir'] . "/$file";

    And now I can regenerate my images.

    my problem is that I have images that are linked like this:

    so, when I try to import it wont work. How can I fix this problem?

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘[Plugin: Regenerate Thumbnails] Failed to resize. Unknown failure reason.’ is closed to new replies.