Regenerate Thumbnails
Call for specific attachment ID? (2 posts)

  1. joshkadis
    Posted 4 years ago #

    Is there a public PHP function that I call to regenerate the thumbnails for a specific image by passing the attachment's ID?


  2. Alex Mills (Viper007Bond)
    Plugin Author

    Posted 4 years ago #

    Yes, look at how the ajax_process_image() function in my plugin works.

    Basically it's this though, although you should check for errors along the way (see function):

    // Get path
    $fullsizepath = get_attached_file( $image_ID );
    // Generate meta data (this makes the thumbnail images)
    $metadata = wp_generate_attachment_metadata( $image_ID, $fullsizepath );
    // Save the meta data so WP knows the thumbs exist
    wp_update_attachment_metadata( $image_ID, $metadata );

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Regenerate Thumbnails
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic