Skip to content

Commit

Permalink
Merge pull request #25 from justcoded/develop
Browse files Browse the repository at this point in the history
Dev mode placeholder image print ID
  • Loading branch information
aprokopenko authored Jun 28, 2018
2 parents b45f5b6 + 4dbf4b5 commit 183f6cb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
4 changes: 2 additions & 2 deletions just-responsive-images.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Plugin Name: Just Responsive Images
Description: Providing full control to set your own responsive image properties for WordPress 4.4+, the ability to use the <picture> tag, auto-generate image backgrounds and supports retina images.
Tags: responsive post thumbnail, post thumbnail as background, retina support, retina image, retina post thumbnail, responsive post attachment, responsive images, responsive attachments, post thumbnails, media
Version: 1.6.0
Version: 1.6.1
Author: JustCoded / Alex Prokopenko
Author URI: http://justcoded.com/
License: GPL3
Expand Down Expand Up @@ -49,7 +49,7 @@ class JustResponsiveImages extends core\Singleton {
protected function __construct() {
// init plugin name and version.
self::$plugin_name = __( 'Just Responsive Images', JustResponsiveImages::TEXTDOMAIN );
self::$version = '1.600';
self::$version = '1.610';

// init features, which this plugin is created for.
new components\Maintenance();
Expand Down
9 changes: 5 additions & 4 deletions models/RwdImage.php
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ public function get_set_sources() {
$option->size->crop
);
if ( JRI_DUMMY_IMAGE && empty( $meta_data['sizes'][ $option->key ]['file'] ) ) {
$dummy_sizes[ $option->key ] = $this->dummy_source( $option, false, $meta_data );
$dummy_sizes[ $option->key ] = $this->dummy_source( $option, false, $attachment->ID, $meta_data );
}

// Resize retina images if not exists.
Expand All @@ -490,7 +490,7 @@ public function get_set_sources() {
);

if ( JRI_DUMMY_IMAGE && empty( $meta_data['sizes'][ $retina_image_size ]['file'] ) ) {
$dummy_sizes[ $retina_image_size ] = $this->dummy_source( $option, $multiplier, $meta_data );
$dummy_sizes[ $retina_image_size ] = $this->dummy_source( $option, $multiplier, $attachment->ID, $meta_data );
}
}
}
Expand Down Expand Up @@ -529,11 +529,12 @@ public function get_set_sources() {
*
* @param RwdOption $option empty image size options.
* @param int|bool $retina_multiplier retina multiplier for retina size.
* @param int $attachment_id attachment ID to get dummy image.
* @param array $meta_data image attachment WP metadata.
*
* @return string
*/
public function dummy_source( $option, $retina_multiplier = false, $meta_data = false ) {
public function dummy_source( $option, $retina_multiplier, $attachment_id, $meta_data ) {

$sizename = $option->key;

Expand All @@ -557,7 +558,7 @@ public function dummy_source( $option, $retina_multiplier = false, $meta_data =
}

$color = substr( md5( "{$meta_data['file']}-$w-$h" ), 0, 6 );
$dummy_url = "http://via.placeholder.com/{$w}x{$h}/$color";
$dummy_url = "http://via.placeholder.com/{$w}x{$h}/$color?text=%23{$attachment_id}:+{$w}x{$h}";

return [
'file' => $dummy_url,
Expand Down
2 changes: 2 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ There are no any special upgrade instructions for version 1.0 - 1.3
To upgrade remove the old plugin folder. After than follow the installation steps 1-2.

== Changelog ==
= Version 1.6.1 - 28 June 2018 =
* Added attachment ID text to dev mode dummy images.
= Version 1.6.0 - 27 June 2018 =
* Dev mode with placeholder images instead of real images in case correct sizes are missing.
= Version 1.5.1 - 3 April 2018 =
Expand Down

0 comments on commit 183f6cb

Please sign in to comment.