Changeset 1813807
- Timestamp:
- 02/01/2018 11:50:55 PM (7 years ago)
- Location:
- opti-mozjpeg-guetzli-webp/trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
opti-mozjpeg-guetzli-webp/trunk/class_wpmjgu_batch_optimization_dialog.php
r1807378 r1813807 188 188 if ($ALL_WPMJGU_SETTINGS['wpmjgu_mode'] === "guetzli") 189 189 { 190 print "<p >Notice: Google Guetzli is terribly slow. Be patient and wait until first output appears on the console.</p>\n";190 print "<p id='lable_guetzli_slow'>Notice: Google Guetzli is terribly slow. Be patient and wait until first output appears on the console.</p>\n"; 191 191 } 192 else193 {194 print "<br>\n";195 }196 192 ?> 193 194 <script src="<?php print plugins_url('/other_includes/FileSaver.js', __FILE__ ); ?>"></script> 195 <input type="button" class="button" id="button_save_log" value="Save console log" onclick="js_save_log();"> 196 197 197 <div id="console"></div> 198 198 <script> … … 376 376 document.getElementById("batch_optimization_status").innerHTML = "Complete"; 377 377 window.onbeforeunload = null; 378 379 js_console("<br>\n<br>\n<br>\n---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n<br>\n<br>\n"); 380 js_console("Batch optimization finished at " + new Date().toLocaleString()); 381 js_console("<br>\n<br>\n<br>\n"); 378 382 379 383 <?php … … 430 434 } 431 435 436 function js_save_log() 437 { 438 var js_tag_console = document.getElementById("console"); 439 var js_console_text = js_tag_console.innerText; 440 js_console_text = js_console_text.replace(/\n/g , '\r\n'); 441 var js_blob = new Blob([js_console_text], {type: "text/plain;charset=utf-8"}); 442 saveAs(js_blob, "wpmjgu_batch_optimization_log.txt"); 443 } 444 445 js_console('Batch optimization started at ' + new Date().toLocaleString()); 432 446 js_batch_continue_optimization(); 433 447 -
opti-mozjpeg-guetzli-webp/trunk/class_wpmjgu_batch_optimization_worker.php
r1807378 r1813807 116 116 117 117 118 118 delete_post_meta(ATTACHMENT_ID, 'wpmjgu_optimized'); 119 119 $r = $this->create_compressed_or_optimized_image(); 120 120 print $r['out']; … … 129 129 $wpmjgu_func->url_file->delete_attachment_thumbnails(CURRENT_PATH); 130 130 $wpmjgu_func->url_file->delete_webp_duplicates(CURRENT_PATH); 131 delete_post_meta(ATTACHMENT_ID, 'wpmjgu_webp_duplicate'); 131 132 132 133 if (CURRENT_PATH !== $new_path) … … 567 568 568 569 $wpmjgu_func->url_file->delete_webp_duplicates(CURRENT_PATH); 570 delete_post_meta(ATTACHMENT_ID, 'wpmjgu_webp_duplicate'); 569 571 570 572 $size = getimagesize(ORIGINAL_PATH); -
opti-mozjpeg-guetzli-webp/trunk/class_wpmjgu_batch_revert_dialog.php
r1807378 r1813807 121 121 </tbody> 122 122 </table> 123 <br><br><br> 123 <br><br> 124 125 <script src="<?php print plugins_url('/other_includes/FileSaver.js', __FILE__ ); ?>"></script> 126 <input type="button" class="button" id="button_save_log" value="Save console log" onclick="js_save_log();"> 127 124 128 <div id="console"></div> 125 129 <script> … … 217 221 js_tag_button.style.visibility = "hidden"; 218 222 document.getElementById("batch_revert_status").innerHTML = "Complete"; 223 224 js_console("<br>\n<br>\n<br>\n---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n<br>\n<br>\n"); 225 js_console("Batch revert finished at " + new Date().toLocaleString()); 226 js_console("<br>\n<br>\n<br>\n"); 219 227 } 220 228 … … 228 236 } 229 237 238 function js_save_log() 239 { 240 var js_tag_console = document.getElementById("console"); 241 var js_console_text = js_tag_console.innerText; 242 js_console_text = js_console_text.replace(/\n/g , '\r\n'); 243 var js_blob = new Blob([js_console_text], {type: "text/plain;charset=utf-8"}); 244 saveAs(js_blob, "wpmjgu_batch_revert_log.txt"); 245 } 246 247 js_console('Batch revert started at ' + new Date().toLocaleString()); 230 248 js_batch_continue_revert(); 231 249 -
opti-mozjpeg-guetzli-webp/trunk/class_wpmjgu_image.php
r1796589 r1813807 237 237 $this->sshc = new \phpseclib\Net\SSH2($ALL_WPMJGU_SETTINGS['wpmjgu_ssh_server'], $ALL_WPMJGU_SETTINGS['wpmjgu_ssh_port']); 238 238 239 if (! @$this->sshc->login($ALL_WPMJGU_SETTINGS['wpmjgu_ssh_username'], $ALL_WPMJGU_SETTINGS['wpmjgu_ssh_password'] )) 239 $attept = 1; 240 while (! @$this->sshc->login($ALL_WPMJGU_SETTINGS['wpmjgu_ssh_username'], $ALL_WPMJGU_SETTINGS['wpmjgu_ssh_password'] )) 240 241 { 241 $ret['out'] .= "Can`t connect to ssh server or bad login\n"; 242 $ret['error'] = true; 243 return $ret; 242 if ($attept > 5) { 243 $ret['out'] .= "Can`t connect to ssh server or bad login\n"; 244 $ret['error'] = true; 245 return $ret; 246 } else { 247 sleep(30); 248 $attept++; 249 } 244 250 } 245 251 } … … 248 254 { 249 255 $this->sftp = new \phpseclib\Net\SFTP($ALL_WPMJGU_SETTINGS['wpmjgu_ssh_server'], $ALL_WPMJGU_SETTINGS['wpmjgu_ssh_port']); 250 if (! @$this->sftp->login($ALL_WPMJGU_SETTINGS['wpmjgu_ssh_username'], $ALL_WPMJGU_SETTINGS['wpmjgu_ssh_password'])) 256 257 $attept = 1; 258 while (! @$this->sftp->login($ALL_WPMJGU_SETTINGS['wpmjgu_ssh_username'], $ALL_WPMJGU_SETTINGS['wpmjgu_ssh_password'])) 251 259 { 252 $ret['out'] .= "Can`t connect to sftp server\n"; 253 $ret['error'] = true; 254 return $ret; 260 if ($attept > 5) { 261 $ret['out'] .= "Can`t connect to sftp server\n"; 262 $ret['error'] = true; 263 return $ret; 264 } else { 265 sleep(30); 266 $attept++; 267 } 255 268 } 256 269 } … … 346 359 } 347 360 361 if ($this->sshc->isTimeout()) 362 { 363 $ret['out'] .= "Ssh server error: Encoder timeout\n"; 364 $ret['error'] = true; 365 return $ret; 366 } 367 348 368 if (! $this->sftp->delete($source_file_ssh_path)) 349 369 { … … 351 371 $ret['error'] = true; 352 372 return $ret; 353 } 373 } 354 374 355 375 if (! $this->sftp->file_exists($dest_file_ssh_path)) 356 376 { 357 $ret['out'] .= "Ssh server error: Output file $dest_file_ssh_path not created\n"; 358 $ret['error'] = true; 359 return $ret; 360 } 361 377 sleep(15); 378 if (! $this->sftp->file_exists($dest_file_ssh_path)) 379 { 380 $ret['out'] .= "Ssh server error: Output file $dest_file_ssh_path not created\n"; 381 $ret['error'] = true; 382 return $ret; 383 } 384 } 385 362 386 if (! $this->sftp->get($dest_file_ssh_path, $dest_file_path)) 363 387 { -
opti-mozjpeg-guetzli-webp/trunk/opti-mozjpeg-guetzli-webp.php
r1807384 r1813807 4 4 Plugin Name: Opti MozJpeg Guetzli WebP 5 5 Plugin URI: http://ihorsl.com/en/wordpress-opti-mozjpeg-guetzli-webp/home/ 6 Version: 0.9 16 Version: 0.95 7 7 Author: Ihor Slyva 8 8 Author uri: http://ihorsl.com … … 53 53 <div class="wrap"> 54 54 <div id="icon-options-general" class="icon32"></div> 55 <h1 id="wpmjgu-title">Opti MozJpeg Guetzli WebP (v0.9 1)</h1>55 <h1 id="wpmjgu-title">Opti MozJpeg Guetzli WebP (v0.95)</h1> 56 56 57 57 … … 192 192 if (! current_user_can('edit_files') ) { die("You don't have enough privileges to pefrom this task\n\n"); } 193 193 194 set_time_limit( 3600);194 set_time_limit(7200); 195 195 $wpmjgu_batch_optimization_worker = new \wpmjgu\class_wpmjgu_batch_optimization_worker(); 196 196 $wpmjgu_batch_optimization_worker->the_html(); -
opti-mozjpeg-guetzli-webp/trunk/readme.txt
r1807384 r1813807 4 4 Donate link: http://ihorsl.com/en/wordpress-opti-mozjpeg-guetzli-webp/home/#donate-wpmjgu 5 5 Requires at least: 4.7 6 Tested up to: 4.9. 16 Tested up to: 4.9.2 7 7 Requires PHP: 5.4 8 Stable tag: 0.9 18 Stable tag: 0.95 9 9 License: GPLv2 10 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 17 17 This plugin uses flowing image encoders: Mozilla MozJpeg, Google Guetzli and Google WebP. But don't worry. There is no necessity to install them into your hosting. The plugin has built-in ssh client. It can access encoders remotely via ssh tunnel. 18 18 19 Plugin's author created a virtual machine for Oracle VirtualBox. It contains Linux, ssh server and Mozilla MozJpeg, Google Guetzli and Google WebP. Simply run this virtual machine on your computer, establish ssh connection between the plugin and the virtual machine and optimize your images for free without any limitations.19 Plugin's author created a virtual machine for Oracle VirtualBox. It contains Linux, ssh server and Mozilla MozJpeg, Google Guetzli and Google WebP. Simply run this virtual machine in your computer, establish ssh connection between the plugin and the virtual machine and optimize your images for free without any limitations. 20 20 21 21 Of course the plugin can use locally installed encoders too. … … 38 38 == Changelog == 39 39 40 = 0.95 = 41 * Added "Save console log" button 42 43 = 0.6 = 44 * Added "Intensive resources consumption mode" in Batch optimization 45 40 46 = 0.5 = 41 47 * First plugin release 42 43 = 0.6 = 44 * Added "Intensive resources consumption mode" in Batch optimization 48 -
opti-mozjpeg-guetzli-webp/trunk/style.css
r1784228 r1813807 187 187 font-style: italic; 188 188 } 189 190 #button_save_log { 191 float: right; 192 margin-bottom: 10px; 193 margin-right: 30px; 194 } 195 196 #lable_guetzli_slow { 197 float: left; 198 }
Note: See TracChangeset
for help on using the changeset viewer.