PluginProbe ʕ •ᴥ•ʔ
Smush – Image Optimization, Compression, Lazy Load, WebP & CDN / 1.6.0
Smush – Image Optimization, Compression, Lazy Load, WebP & CDN v1.6.0
4.1.0 4.0.3 4.0.2 2.8.1 2.9.1 3.0.0 3.0.1 3.0.2 3.1.1 3.10.1 3.10.2 3.10.3 3.11.1 3.12.3 3.12.4 3.12.5 3.12.6 3.13.0 3.13.1 3.13.2 3.14.0 3.14.1 3.14.2 3.15.0 3.15.1 3.15.2 3.15.3 3.15.4 3.15.5 3.16.2 3.16.4 3.16.5 3.16.6 3.17.0 3.17.1 3.18.0 3.18.1 3.2.0.1 3.2.1 3.2.2.1 3.2.4 3.20.0 3.21.1 3.22.1 3.22.3 3.23.0 3.23.1 3.23.2 3.23.3 3.23.4 3.24.0 3.24.0-beta.2 3.3.0 3.3.1 3.3.2 3.4.1 3.4.2 3.6.1 3.6.3 3.7.0 3.7.1 3.7.2 3.7.3 3.8.2 3.8.3 3.8.4 3.8.5 3.8.7 3.8.8 3.9.0 3.9.1 3.9.11 3.9.2 3.9.4 3.9.5 3.9.8 3.9.9 trunk 1.0.0 1.0.1 1.0.2 1.1 1.1.1 1.1.2 1.1.3 1.2 1.2.1 1.2.10 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.1 1.3.2 1.3.3 1.3.4 1.4.0 1.4.1 1.4.2 1.4.3 1.5.0 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.5.1 1.6.5.2 1.6.5.3 1.6.5.4 1.7 1.7.1 1.7.1.1 2.0 2.0.1 2.0.3 2.0.4 2.0.5 2.0.6 2.0.6.2 2.0.6.3 2.0.6.5 2.0.7 2.0.7.1 2.1 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.2 2.2.1 2.2.2 2.3 2.3.1 2.4 2.4.2 2.4.3 2.4.4 2.4.5 2.5.2 2.5.3 2.6.1 2.6.2 2.6.3 2.7 2.7.1 2.7.4 2.7.4.1 2.7.5 2.7.6 2.7.8 2.7.8.1 2.7.9.1 2.8.0 2.8.0.1
wp-smushit / bulk.php
wp-smushit Last commit date
JSON 17 years ago bulk.php 14 years ago license.txt 17 years ago readme.txt 13 years ago screenshot-1.jpg 17 years ago settings.php 13 years ago wp-smushit.php 14 years ago
bulk.php
77 lines
1 <div class="wrap">
2 <div id="icon-upload" class="icon32"><br /></div><h2>Bulk WP Smush.it </h2>
3
4 <?php
5
6 if ( sizeof($attachments) < 1 ):
7 echo '<p>You don’t appear to have uploaded any images yet.</p>';
8 else:
9 if ( empty($_POST) && !$auto_start ): // instructions page
10 ?>
11 <p>This tool will run all of the images in your media library through the WP Smush.it web service. It won't re-smush images that were successfully smushed before. It will retry images that were not successfully smushed.</p>
12
13 <p>It uploads each and every file to Yahoo! and then downloads the resulting file. It can take a long time.</p>
14
15 <p>We found <?php echo sizeof($attachments); ?> images in your media library. Be forewarned, <strong>it will take <em>at least</em> <?php echo (sizeof($attachments) * 3 / 60); ?> minutes</strong> to process all these images if they have never been smushed before.</p>
16
17 <p><em>N.B. If your server <tt>gzip</tt>s content you may not see the progress updates as your files are processed.</em></p>
18
19 <p><strong>This is an experimental feature.</strong> Please post any feedback to the <a href="http://wordpress.org/tags/wp-smushit">WordPress WP Smush.it forums</a>.</p>
20
21 <form method="post" action="">
22 <?php wp_nonce_field( 'wp-smushit-bulk', '_wpnonce'); ?>
23 <button type="submit" class="button-secondary action">Run all my images through WP Smush.it right now</button>
24 </form>
25
26 <?php
27 else: // run the script
28
29 if (!wp_verify_nonce( $_REQUEST['_wpnonce'], 'wp-smushit-bulk' ) || !current_user_can( 'edit_others_posts' ) ) {
30 wp_die( __( 'Cheatin&#8217; uh?' ) );
31 }
32
33
34 ob_implicit_flush(true);
35 ob_end_flush();
36 foreach( $attachments as $attachment ) {
37 printf( "<p>Processing <strong>%s</strong>&hellip;<br>", esc_html($attachment->post_name) );
38 $original_meta = wp_get_attachment_metadata( $attachment->ID, true );
39
40 $meta = wp_smushit_resize_from_meta_data( $original_meta, $attachment->ID, false );
41
42 printf( "– %dx%d: ", intval($meta['width']), intval($meta['height']) );
43
44 if ( $original_meta['wp_smushit'] == $meta['wp_smushit'] && stripos( $meta['wp_smushit'], 'Smush.it error' ) === false ) {
45 echo 'already smushed' . $meta['wp_smushit'];
46 } else {
47 echo $meta['wp_smushit'];
48 }
49 echo '<br>';
50
51
52
53 if ( isset( $meta['sizes'] ) && is_array( $meta['sizes'] ) ) {
54 foreach( $meta['sizes'] as $size_name => $size ) {
55 printf( "– %dx%d: ", intval($size['width']), intval($size['height']) );
56 if ( $original_meta['sizes'][$size_name]['wp_smushit'] == $size['wp_smushit'] && stripos( $meta['sizes'][$size_name]['wp_smushit'], 'Smush.it error' ) === false ) {
57 echo 'already smushed';
58 } else {
59 echo $size['wp_smushit'];
60 }
61 echo '<br>';
62
63 }
64 }
65 echo "</p>";
66
67 wp_update_attachment_metadata( $attachment->ID, $meta );
68
69 // rate limiting is good manners, let's be nice to Yahoo!
70 sleep(0.5);
71 @ob_flush();
72 flush();
73 }
74 endif;
75 endif;
76 ?>
77 </div>