I’ve created a front end form that allow me to insert posts. I successfully upload thumbnails and attach them to the posts but I recently tried to add an image size for a slider and that won’t work.
When I try adding posts from the Dashboard the new images with the proper sizes are created but not when I try inserting a post from the front end. Even thou from the front end, I get the thumbnail proper custom size created.
Here’s my code
add_theme_support( 'post-thumbnails' ); set_post_thumbnail_size( 200, 200, true); //For featured images add_image_size( 'homepage-featured', 960, 300, true );//Automatic crop
Image Handling code:
require_once(ABSPATH . "wp-admin" . '/includes/image.php'); require_once(ABSPATH . "wp-admin" . '/includes/file.php'); require_once(ABSPATH . "wp-admin" . '/includes/media.php'); $attachment_id = media_handle_upload($file, $post_id); update_post_meta($post_id, '_thumbnail_id', $attachment_id); $attachment_data = array( 'ID' => $attachment_id ); wp_update_post($attachment_data);
- The topic ‘Multiple image sizes not working’ is closed to new replies.