Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Mizuho Ogino

    (@fishpie)

    Hi derrickmg.

    Activate the plugin and add this code to your functions.php.
    Then, Click “Regenerate PDF” link in “settings”.
    After generating images, remove function from your php.

    Thank you.

    function regenerate_pdf_image_menu() {
      add_options_page('Force regenerate uploaded PDFs', 'Regenerate PDF', 5, 'regenerate_pdf', 'regenerate_pdf_image_page');
    }
    function regenerate_pdf_image_page() {
      echo '<div class="wrap"><h2>Regenerate uploaded PDFs</h2>';
    	$pdfs = get_posts(array('post_type'=>'attachment','post_mime_type'=>'application/pdf','numberposts'=>-1));
    	if($pdfs): foreach($pdfs as $pdf):
    		$thumbnail_id = get_post_meta( $pdf->ID, '_thumbnail_id', true );
    		if( $thumbnail_id ){
    			echo 'attachment id: '.$pdf->ID.' / A thumb is already exist.<br/>';
    		} else {
    			pigen_attachment($pdf->ID);
    			echo 'attachment id: '.$pdf->ID.' / A thumb is generated!! <br/>';
    		}
    	endforeach; endif;
      echo '</div>';
    }
    add_action('admin_menu', 'regenerate_pdf_image_menu');
    Thread Starter derrickmg

    (@derrickmg)

    Worked great thanks

    Thread Starter derrickmg

    (@derrickmg)

    resolved

    Mikey B

    (@mikebackhouse)

    Great! I needed that too, thanks Mizuho! I was worried I was going to have to re-upload all my PDFs ??

    Plugin Author Mizuho Ogino

    (@fishpie)

    I uploaded the plugin to 1.2.1. and add the plugin page in ‘setting.’
    You can generate thumbnails in there.

    Thread Starter derrickmg

    (@derrickmg)

    Thats awesome, thanks, great plugin.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Generate image for existing pdf's’ is closed to new replies.