Photo Gallery by Envira – Responsive Image Gallery for WordPress - Version 1.5.0.8

Version Description

Download this release

Release Info

Developer dimensionmedia
Plugin Icon 128x128 Photo Gallery by Envira – Responsive Image Gallery for WordPress
Version 1.5.0.8
Comparing to
See all releases

Code changes from version 1.5.0.7 to 1.5.0.8

envira-gallery-lite.php CHANGED
@@ -5,7 +5,7 @@
5
  * Description: Envira Gallery is best responsive WordPress gallery plugin. This is the lite version.
6
  * Author: Thomas Griffin
7
  * Author URI: http://enviragallery.com
8
- * Version: 1.5.0.7
9
  * Text Domain: envira-gallery
10
  *
11
  * Envira Gallery is free software: you can redistribute it and/or modify
@@ -53,7 +53,7 @@ class Envira_Gallery_Lite {
53
  *
54
  * @var string
55
  */
56
- public $version = '1.5.0.7';
57
 
58
  /**
59
  * The name of the plugin.
5
  * Description: Envira Gallery is best responsive WordPress gallery plugin. This is the lite version.
6
  * Author: Thomas Griffin
7
  * Author URI: http://enviragallery.com
8
+ * Version: 1.5.0.8
9
  * Text Domain: envira-gallery
10
  *
11
  * Envira Gallery is free software: you can redistribute it and/or modify
53
  *
54
  * @var string
55
  */
56
+ public $version = '1.5.0.8';
57
 
58
  /**
59
  * The name of the plugin.
includes/admin/metaboxes.php CHANGED
@@ -2086,14 +2086,18 @@ class Envira_Gallery_Metaboxes {
2086
  *
2087
  * @param array $args Array of args used when cropping the images.
2088
  * @param int $post_id The current post ID.
 
2089
  */
2090
- public function crop_thumbnails( $args, $post_id ) {
2091
 
2092
  // Gather all available images to crop.
2093
  $gallery_data = get_post_meta( $post_id, '_eg_gallery_data', true );
2094
  $images = ! empty( $gallery_data['gallery'] ) ? $gallery_data['gallery'] : false;
2095
  $common = Envira_Gallery_Common::get_instance();
2096
 
 
 
 
2097
  // Loop through the images and crop them.
2098
  if ( $images ) {
2099
  // Increase the time limit to account for large image sets and suspend cache invalidations.
@@ -2117,7 +2121,10 @@ class Envira_Gallery_Metaboxes {
2117
  }
2118
 
2119
  // Generate the cropped image.
2120
- $cropped_image = $common->resize_image( $image[0], $args['width'], $args['height'], true, $args['position'], $args['quality'], $args['retina'] );
 
 
 
2121
 
2122
  // If there is an error, possibly output error message, otherwise woot!
2123
  if ( is_wp_error( $cropped_image ) ) {
@@ -2151,8 +2158,9 @@ class Envira_Gallery_Metaboxes {
2151
  *
2152
  * @param array $args Array of args used when cropping the images.
2153
  * @param int $post_id The current post ID.
 
2154
  */
2155
- public function crop_images( $args, $post_id ) {
2156
 
2157
  // Gather all available images to crop.
2158
  $gallery_data = get_post_meta( $post_id, '_eg_gallery_data', true );
@@ -2181,7 +2189,7 @@ class Envira_Gallery_Metaboxes {
2181
  }
2182
 
2183
  // Generate the cropped image.
2184
- $cropped_image = $common->resize_image( $image[0], $args['width'], $args['height'], true, $args['position'], $args['quality'], $args['retina'] );
2185
 
2186
  // If there is an error, possibly output error message, otherwise woot!
2187
  if ( is_wp_error( $cropped_image ) ) {
2086
  *
2087
  * @param array $args Array of args used when cropping the images.
2088
  * @param int $post_id The current post ID.
2089
+ * @param bool $force_overwrite Forces an overwrite even if the thumbnail already exists (useful for applying watermarks)
2090
  */
2091
+ public function crop_thumbnails( $args, $post_id, $force_overwrite = false ) {
2092
 
2093
  // Gather all available images to crop.
2094
  $gallery_data = get_post_meta( $post_id, '_eg_gallery_data', true );
2095
  $images = ! empty( $gallery_data['gallery'] ) ? $gallery_data['gallery'] : false;
2096
  $common = Envira_Gallery_Common::get_instance();
2097
 
2098
+ // echo "---"; print_r ($gallery_data);
2099
+ // print_r ($images);
2100
+
2101
  // Loop through the images and crop them.
2102
  if ( $images ) {
2103
  // Increase the time limit to account for large image sets and suspend cache invalidations.
2121
  }
2122
 
2123
  // Generate the cropped image.
2124
+ $cropped_image = $common->resize_image( $image[0], $args['width'], $args['height'], true, $args['position'], $args['quality'], $args['retina'], null, $force_overwrite );
2125
+
2126
+ // print_r ($image);
2127
+ // echo "!!!!!"; print_r ($cropped_image); exit;
2128
 
2129
  // If there is an error, possibly output error message, otherwise woot!
2130
  if ( is_wp_error( $cropped_image ) ) {
2158
  *
2159
  * @param array $args Array of args used when cropping the images.
2160
  * @param int $post_id The current post ID.
2161
+ * @param bool $force_overwrite Forces an overwrite even if the thumbnail already exists (useful for applying watermarks)
2162
  */
2163
+ public function crop_images( $args, $post_id, $force_overwrite = false ) {
2164
 
2165
  // Gather all available images to crop.
2166
  $gallery_data = get_post_meta( $post_id, '_eg_gallery_data', true );
2189
  }
2190
 
2191
  // Generate the cropped image.
2192
+ $cropped_image = $common->resize_image( $image[0], $args['width'], $args['height'], true, $args['position'], $args['quality'], $args['retina'], null, $force_overwrite );
2193
 
2194
  // If there is an error, possibly output error message, otherwise woot!
2195
  if ( is_wp_error( $cropped_image ) ) {
includes/global/common.php CHANGED
@@ -746,9 +746,10 @@ class Envira_Gallery_Common {
746
  * @param string $align The crop position alignment.
747
  * @param bool $retina Whether or not to make a retina copy of image.
748
  * @param array $data Array of gallery data (optional).
 
749
  * @return WP_Error|string Return WP_Error on error, URL of resized image on success.
750
  */
751
- public function resize_image( $url, $width = null, $height = null, $crop = true, $align = 'c', $quality = 100, $retina = false, $data = array() ) {
752
 
753
  global $wpdb;
754
 
@@ -778,15 +779,19 @@ class Envira_Gallery_Common {
778
  }
779
 
780
  // If the destination width/height values are the same as the original, don't do anything.
781
- if ( $orig_width === $dest_width && $orig_height === $dest_height ) {
782
  return $url;
783
  }
784
 
 
 
785
  // If the file doesn't exist yet, we need to create it.
786
- if ( ! file_exists( $dest_file_name ) ) {
787
  // We only want to resize Media Library images, so we can be sure they get deleted correctly when appropriate.
788
  $get_attachment = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->posts WHERE guid='%s'", $url ) );
789
 
 
 
790
  // Load the WordPress image editor.
791
  $editor = wp_get_image_editor( $file_path );
792
 
746
  * @param string $align The crop position alignment.
747
  * @param bool $retina Whether or not to make a retina copy of image.
748
  * @param array $data Array of gallery data (optional).
749
+ * @param bool $force_overwrite Forces an overwrite even if the thumbnail already exists (useful for applying watermarks)
750
  * @return WP_Error|string Return WP_Error on error, URL of resized image on success.
751
  */
752
+ public function resize_image( $url, $width = null, $height = null, $crop = true, $align = 'c', $quality = 100, $retina = false, $data = array(), $force_overwrite = false ) {
753
 
754
  global $wpdb;
755
 
779
  }
780
 
781
  // If the destination width/height values are the same as the original, don't do anything.
782
+ if ( !$force_overwrite && $orig_width === $dest_width && $orig_height === $dest_height ) {
783
  return $url;
784
  }
785
 
786
+
787
+
788
  // If the file doesn't exist yet, we need to create it.
789
+ if ( ! file_exists( $dest_file_name ) || ( file_exists( $dest_file_name ) && $force_overwrite ) ) {
790
  // We only want to resize Media Library images, so we can be sure they get deleted correctly when appropriate.
791
  $get_attachment = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->posts WHERE guid='%s'", $url ) );
792
 
793
+ // print_r ($get_attachment); exit;
794
+
795
  // Load the WordPress image editor.
796
  $editor = wp_get_image_editor( $file_path );
797
 
includes/global/shortcode.php CHANGED
@@ -997,6 +997,9 @@ class Envira_Gallery_Shortcode {
997
  $.each(envira_buttons_<?php echo $data['id']; ?>, function(i, val){
998
  envira_buttons_total_<?php echo $data['id']; ?> += parseInt(val, 10);
999
  });
 
 
 
1000
  $('#envirabox-buttons ul').width(envira_buttons_total_<?php echo $data['id']; ?>);
1001
  $('#envirabox-buttons').width(envira_buttons_total_<?php echo $data['id']; ?>).css('left', ($(window).width() - envira_buttons_total_<?php echo $data['id']; ?>)/2);
1002
  <?php endif; ?>
@@ -1252,10 +1255,11 @@ class Envira_Gallery_Shortcode {
1252
  $image = $item['src'];
1253
  endif;
1254
 
 
 
1255
  if ( !$src ) :
1256
 
1257
  // Check if this Gallery uses a WordPress defined image size
1258
- $image_size = $this->get_config( 'image_size', $data );
1259
  if ( $image_size != 'default' && ! $retina ) {
1260
  // If image size is envira_gallery_random, get a random image size.
1261
  if ( $image_size == 'envira_gallery_random' ) {
997
  $.each(envira_buttons_<?php echo $data['id']; ?>, function(i, val){
998
  envira_buttons_total_<?php echo $data['id']; ?> += parseInt(val, 10);
999
  });
1000
+
1001
+ envira_buttons_total_<?php echo $data['id']; ?> += 1;
1002
+
1003
  $('#envirabox-buttons ul').width(envira_buttons_total_<?php echo $data['id']; ?>);
1004
  $('#envirabox-buttons').width(envira_buttons_total_<?php echo $data['id']; ?>).css('left', ($(window).width() - envira_buttons_total_<?php echo $data['id']; ?>)/2);
1005
  <?php endif; ?>
1255
  $image = $item['src'];
1256
  endif;
1257
 
1258
+ $image_size = $this->get_config( 'image_size', $data );
1259
+
1260
  if ( !$src ) :
1261
 
1262
  // Check if this Gallery uses a WordPress defined image size
 
1263
  if ( $image_size != 'default' && ! $retina ) {
1264
  // If image size is envira_gallery_random, get a random image size.
1265
  if ( $image_size == 'envira_gallery_random' ) {
languages/envira-gallery.pot CHANGED
@@ -2,9 +2,9 @@
2
  # This file is distributed under the same license as the Envira Gallery Lite package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: Envira Gallery Lite 1.5.0.7\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/envira-gallery\n"
7
- "POT-Creation-Date: 2016-07-29 17:13:57+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
@@ -1398,19 +1398,19 @@ msgstr ""
1398
  msgid "Yes"
1399
  msgstr ""
1400
 
1401
- #: includes/global/common.php:795
1402
  msgid "No image editor could be selected. Please verify with your webhost that you have either the GD or Imagick image library compiled with your PHP install on your server."
1403
  msgstr ""
1404
 
1405
- #: includes/global/common.php:898
1406
  msgid "No image URL specified for cropping."
1407
  msgstr ""
1408
 
1409
- #: includes/global/common.php:917
1410
  msgid "No file could be found for the image URL specified."
1411
  msgstr ""
1412
 
1413
- #: includes/global/common.php:925 includes/global/common.php:937
1414
  msgid "The dimensions of the original image could not be retrieved for cropping."
1415
  msgstr ""
1416
 
@@ -1454,15 +1454,15 @@ msgstr ""
1454
  msgid "The requested content cannot be loaded.<br/>Please try again later.</p>"
1455
  msgstr ""
1456
 
1457
- #: includes/global/shortcode.php:821 includes/global/shortcode.php:1405
1458
  msgid "Close"
1459
  msgstr ""
1460
 
1461
- #: includes/global/shortcode.php:822 includes/global/shortcode.php:1395
1462
  msgid "Next"
1463
  msgstr ""
1464
 
1465
- #: includes/global/shortcode.php:823 includes/global/shortcode.php:1391
1466
  msgid "Previous"
1467
  msgstr ""
1468
 
2
  # This file is distributed under the same license as the Envira Gallery Lite package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: Envira Gallery Lite 1.5.0.8\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/envira-gallery\n"
7
+ "POT-Creation-Date: 2016-08-04 19:21:08+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
1398
  msgid "Yes"
1399
  msgstr ""
1400
 
1401
+ #: includes/global/common.php:800
1402
  msgid "No image editor could be selected. Please verify with your webhost that you have either the GD or Imagick image library compiled with your PHP install on your server."
1403
  msgstr ""
1404
 
1405
+ #: includes/global/common.php:903
1406
  msgid "No image URL specified for cropping."
1407
  msgstr ""
1408
 
1409
+ #: includes/global/common.php:922
1410
  msgid "No file could be found for the image URL specified."
1411
  msgstr ""
1412
 
1413
+ #: includes/global/common.php:930 includes/global/common.php:942
1414
  msgid "The dimensions of the original image could not be retrieved for cropping."
1415
  msgstr ""
1416
 
1454
  msgid "The requested content cannot be loaded.<br/>Please try again later.</p>"
1455
  msgstr ""
1456
 
1457
+ #: includes/global/shortcode.php:821 includes/global/shortcode.php:1409
1458
  msgid "Close"
1459
  msgstr ""
1460
 
1461
+ #: includes/global/shortcode.php:822 includes/global/shortcode.php:1399
1462
  msgid "Next"
1463
  msgstr ""
1464
 
1465
+ #: includes/global/shortcode.php:823 includes/global/shortcode.php:1395
1466
  msgid "Previous"
1467
  msgstr ""
1468