Login Logo - Version 0.2

Version Description

  • Do not use background-size unless the image is more than 326 pixels
Download this release

Release Info

Developer markjaquith
Plugin Icon wp plugin Login Logo
Version 0.2
Comparing to
See all releases

Code changes from version 0.1 to 0.2

Files changed (2) hide show
  1. login-logo.php +9 -6
  2. readme.txt +4 -1
login-logo.php CHANGED
@@ -2,7 +2,7 @@
2
  /*
3
  Plugin Name: Login Logo
4
  Description: Drop a PNG file named <code>login-logo.png</code> into your <code>wp-content</code> directory. This simple plugin takes care of the rest, with zero configuration. Transparent backgrounds work best. Keep the width below 326 pixels.
5
- Version: 0.1
6
  License: GPL
7
  Author: Mark Jaquith
8
  Author URI: http://coveredwebservices.com/
@@ -10,6 +10,7 @@ Author URI: http://coveredwebservices.com/
10
 
11
  class CWS_Login_Logo_Plugin {
12
  static $instance;
 
13
  var $logo_path;
14
  var $logo_url;
15
  var $width = 0;
@@ -63,11 +64,11 @@ class CWS_Login_Logo_Plugin {
63
  $this->width = $sizes[0];
64
  $this->height = $sizes[1];
65
  $this->original_height = $this->height;
66
- if ( $this->width > 326 ) {
67
  // Use CSS 3 scaling
68
  $ratio = $this->height / $this->width;
69
- $this->height = ceil( $ratio * 326 );
70
- $this->width = 326;
71
  }
72
  } else {
73
  $this->logo_file_exists = false;
@@ -88,17 +89,19 @@ class CWS_Login_Logo_Plugin {
88
  <style type="text/css">
89
  h1 a {
90
  background: url(<?php echo esc_url_raw( $this->logo_url ); ?>) no-repeat top center;
91
- width: 326px;
92
  height: <?php echo $this->get_height() + 3; ?>px;
93
- <?php $this->css3( 'background-size', 'contain' ); ?>
94
  }
95
  </style>
 
96
  <!--[if lt IE 9]>
97
  <style type="text/css">
98
  height: <?php echo $this->get_original_height() + 3; ?>px;
99
  </style>
100
  <![endif]-->
101
  <?php
 
102
  }
103
 
104
  }
2
  /*
3
  Plugin Name: Login Logo
4
  Description: Drop a PNG file named <code>login-logo.png</code> into your <code>wp-content</code> directory. This simple plugin takes care of the rest, with zero configuration. Transparent backgrounds work best. Keep the width below 326 pixels.
5
+ Version: 0.2
6
  License: GPL
7
  Author: Mark Jaquith
8
  Author URI: http://coveredwebservices.com/
10
 
11
  class CWS_Login_Logo_Plugin {
12
  static $instance;
13
+ const cutoff = 326;
14
  var $logo_path;
15
  var $logo_url;
16
  var $width = 0;
64
  $this->width = $sizes[0];
65
  $this->height = $sizes[1];
66
  $this->original_height = $this->height;
67
+ if ( $this->width > self::cutoff ) {
68
  // Use CSS 3 scaling
69
  $ratio = $this->height / $this->width;
70
+ $this->height = ceil( $ratio * self::cutoff );
71
+ $this->width = self::cutoff;
72
  }
73
  } else {
74
  $this->logo_file_exists = false;
89
  <style type="text/css">
90
  h1 a {
91
  background: url(<?php echo esc_url_raw( $this->logo_url ); ?>) no-repeat top center;
92
+ width: <?php echo self::cutoff; ?>px;
93
  height: <?php echo $this->get_height() + 3; ?>px;
94
+ <?php if ( self::cutoff < $this->get_width() ) $this->css3( 'background-size', 'contain' ); ?>
95
  }
96
  </style>
97
+ <?php if ( self::cutoff < $this->get_width() ) { ?>
98
  <!--[if lt IE 9]>
99
  <style type="text/css">
100
  height: <?php echo $this->get_original_height() + 3; ?>px;
101
  </style>
102
  <![endif]-->
103
  <?php
104
+ }
105
  }
106
 
107
  }
readme.txt CHANGED
@@ -41,9 +41,12 @@ Your image is probably too wide. Wide images are scaled down in IE 9 or other mo
41
 
42
  == Changelog ==
43
 
 
 
 
44
  = 0.1 =
45
  * Original version
46
 
47
  == Upgrade Notice ==
48
 
49
- Upgrade now!
41
 
42
  == Changelog ==
43
 
44
+ = 0.2 =
45
+ * Do not use `background-size` unless the image is more than 326 pixels
46
+
47
  = 0.1 =
48
  * Original version
49
 
50
  == Upgrade Notice ==
51
 
52
+ Upgrade now to avoid stretching small images