Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
  • 3 commits
  • 4 files changed
  • 0 commit comments
  • 1 contributor
View
12 src/wp-admin/css/wp-admin.css
@@ -4689,6 +4689,12 @@ borger color while dragging a file over the uploader drop area */
.imgedit-wrap {
position: relative;
+ background-color: #fff;
+ background-image: -webkit-linear-gradient(45deg, #ccc 25%, transparent 25%, transparent),
+ -webkit-linear-gradient(-45deg, #ccc 25%, transparent 25%, transparent),
+ -webkit-linear-gradient(45deg, transparent 75%, #ccc 75%),
+ -webkit-linear-gradient(-45deg, transparent 75%, #ccc 75%);
+ background-size: 25px 25px;
}
.imgedit-settings p {
@@ -4754,6 +4760,12 @@ td.imgedit-settings input {
.wp_attachment_image,
.A1B1 {
overflow: hidden;
+ background-color: #fff;
+ background-image: -webkit-linear-gradient(45deg, #ccc 25%, transparent 25%, transparent),
+ -webkit-linear-gradient(-45deg, #ccc 25%, transparent 25%, transparent),
+ -webkit-linear-gradient(45deg, transparent 75%, #ccc 75%),
+ -webkit-linear-gradient(-45deg, transparent 75%, #ccc 75%);
+ background-size: 25px 25px;
}
.wp_attachment_image .button,
View
5 src/wp-content/themes/twentytwelve/style.css
@@ -525,6 +525,11 @@ a:hover {
padding: 0 24px;
padding: 0 1.714285714rem;
background-color: #fff;
+ background-image: -webkit-linear-gradient(45deg, #ccc 25%, transparent 25%, transparent),
+ -webkit-linear-gradient(-45deg, #ccc 25%, transparent 25%, transparent),
+ -webkit-linear-gradient(45deg, transparent 75%, #ccc 75%),
+ -webkit-linear-gradient(-45deg, transparent 75%, #ccc 75%);
+ background-size: 25px 25px;
}
.site-content {
margin: 24px 0 0;
View
12 src/wp-includes/class-wp-image-editor-gd.php
@@ -163,7 +163,7 @@ protected function _resize( $max_w, $max_h, $crop = false ) {
}
list( $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h ) = $dims;
- $resized = wp_imagecreatetruecolor( $dst_w, $dst_h );
+ $resized = wp_imagecreatetruecolor( $dst_w, $dst_h, $this->mime_type, $this->image );
imagecopyresampled( $resized, $this->image, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h );
if ( is_resource( $resized ) ) {
@@ -241,7 +241,7 @@ public function crop( $src_x, $src_y, $src_w, $src_h, $dst_w = null, $dst_h = nu
if ( ! $dst_h )
$dst_h = $src_h;
- $dst = wp_imagecreatetruecolor( $dst_w, $dst_h );
+ $dst = wp_imagecreatetruecolor( $dst_w, $dst_h, $this->mime_type, $this->image );
if ( $src_abs ) {
$src_w -= $src_x;
@@ -275,7 +275,9 @@ public function crop( $src_x, $src_y, $src_w, $src_h, $dst_w = null, $dst_h = nu
*/
public function rotate( $angle ) {
if ( function_exists('imagerotate') ) {
- $rotated = imagerotate( $this->image, $angle, 0 );
+ $transparent_index = imagecolortransparent( $this->image );
+ $rotated = imagerotate( $this->image, $angle, $transparent_index );
+ imagecolortransparent( $this->image, $transparent_index );
if ( is_resource( $rotated ) ) {
imagedestroy( $this->image );
@@ -300,7 +302,7 @@ public function rotate( $angle ) {
public function flip( $horz, $vert ) {
$w = $this->size['width'];
$h = $this->size['height'];
- $dst = wp_imagecreatetruecolor( $w, $h );
+ $dst = wp_imagecreatetruecolor( $w, $h, $this->mime_type, $this->image );
if ( is_resource( $dst ) ) {
$sx = $vert ? ($w - 1) : 0;
@@ -308,7 +310,7 @@ public function flip( $horz, $vert ) {
$sw = $vert ? -$w : $w;
$sh = $horz ? -$h : $h;
- if ( imagecopyresampled( $dst, $this->image, 0, 0, $sx, $sy, $w, $h, $sw, $sh ) ) {
+ if ( imagecopymerge( $dst, $this->image, 0, 0, $sx, $sy, $sw, $sh, 50 ) ) {
imagedestroy( $this->image );
$this->image = $dst;
return true;
View
33 src/wp-includes/media.php
@@ -1221,13 +1221,36 @@ function get_taxonomies_for_attachments( $output = 'names' ) {
*
* @param int $width Image width
* @param int $height Image height
+ * @param int $image_type Image type
+ * @param resource $original_image Original image
* @return image resource
*/
-function wp_imagecreatetruecolor($width, $height) {
- $img = imagecreatetruecolor($width, $height);
- if ( is_resource($img) && function_exists('imagealphablending') && function_exists('imagesavealpha') ) {
- imagealphablending($img, false);
- imagesavealpha($img, true);
+function wp_imagecreatetruecolor( $width, $height, $image_type = null, $original_image = null ) {
+ $img = imagecreatetruecolor( $width, $height );
+ if ( ! is_resource( $img ) )
+ return false;
+
+ if( 'image/gif' === $image_type && is_resource( $original_image ) && function_exists( 'imagecolortransparent' ) ) {
+ // If the original image is GIF, we actually need a palette image.
+ imagetruecolortopalette( $img, true, 255 );
+ // Use the same palette of colors as the original image. This also
+ // needs to be done for the transparent index to be valid in the
+ // new image.
+ //imagepalettecopy( $img, $original_image );
+ $original_transparent_index = imagecolortransparent( $original_image );
+ if ( $original_transparent_index >= 0 )
+ {
+ $transparent_color = imagecolorsforindex( $original_image, $original_transparent_index );
+ $transparent_index = imagecolorallocate( $img, $transparent_color['red'], $transparent_color['green'], $transparent_color['blue'] );
+ imagefill( $img, 0, 0, $transparent_index );
+ imagecolortransparent( $img, $transparent_index );
+ //imagetruecolortopalette( $img, false, 255 );
+ }
+ } elseif ( 'image/png' === $image_type && function_exists( 'imagealphablending' ) && function_exists( 'imagesavealpha' ) ) {
+ //if ( function_exists( 'imagecolortransparent' ) )
+ // imagecolortransparent( $img, imagecolortransparent( $original_image ) );
+ imagealphablending( $img, false );
+ imagesavealpha( $img, true );
}
return $img;
}

No commit comments for this range

Something went wrong with that request. Please try again.