Photo Gallery by WD – Responsive Photo Gallery - Version 1.2.106

Version Description

IMPORTANT: Instagram changed the API. You need to get a new access token by using "Sign in with Instagram" button on the Options page in order to keep your Instagram Gallery functioning after June 1. * Changed: Instagram new API. * Changed: Increase get_options count.

Download this release

Release Info

Developer webdorado
Plugin Icon 128x128 Photo Gallery by WD – Responsive Photo Gallery
Version 1.2.106
Comparing to
See all releases

Code changes from version 1.2.105 to 1.2.106

admin/views/BWGViewEditThumb.php CHANGED
@@ -28,6 +28,19 @@ class BWGViewEditThumb {
28
  $image_width = $popup_width - 40;
29
  $popup_height = ((int) (isset($_GET['height']) ? esc_html($_GET['height']) : '500')) - 50;
30
  $image_height = $popup_height - 40;
 
 
 
 
 
 
 
 
 
 
 
 
 
31
  $image_id = (isset($_GET['image_id']) ? esc_html($_GET['image_id']) : '0');
32
  ?>
33
  <div style="display:table; width:100%; height:<?php echo $popup_height; ?>px;">
@@ -53,7 +66,7 @@ class BWGViewEditThumb {
53
  window.document.getElementById("bwg_container_for_media_1").innerHTML = spider_display_embed(file_type, embed_id, {class:"embed_display", width:"<?php echo $image_width; ?>", height:"<?php echo $image_height; ?>", frameborder:"0", allowfullscreen:"allowfullscreen", style:"width:<?php echo $image_width; ?>px; height:<?php echo $image_height; ?>px; vertical-align:middle; text-align: center; margin: 0 auto;" });
54
  }
55
  else{
56
- window.document.getElementById("bwg_container_for_media_1").innerHTML = spider_display_embed(file_type, embed_id, {class:"embed_display", width:"<?php echo $image_height -88; ?>", height:"<?php echo $image_height; ?>", frameborder:"0", allowfullscreen:"allowfullscreen", style:"width:<?php echo $image_height -88 ; ?>px; height:<?php echo $image_height; ?>px; vertical-align:middle; text-align: center; margin: 0 auto;" });
57
  }
58
  }
59
  </script>
28
  $image_width = $popup_width - 40;
29
  $popup_height = ((int) (isset($_GET['height']) ? esc_html($_GET['height']) : '500')) - 50;
30
  $image_height = $popup_height - 40;
31
+
32
+ $instagram_post_width = ((int) (isset($_GET['instagram_post_width']) ? esc_html($_GET['instagram_post_width']) : $image_width));
33
+ $instagram_post_height = ((int) (isset($_GET['instagram_post_height']) ? esc_html($_GET['instagram_post_height']) : $image_height));
34
+
35
+ if ($image_height / ($instagram_post_height + 96) < $image_width / $instagram_post_width) {
36
+ $instagram_post_width = ($image_height - 96) * $instagram_post_width / $instagram_post_height + 16;
37
+ $instagram_post_height = $image_height;
38
+ }
39
+ else {
40
+ $instagram_post_height = ($image_width - 16) * $instagram_post_height / $instagram_post_width + 16;
41
+ $instagram_post_width = $image_width;
42
+ }
43
+
44
  $image_id = (isset($_GET['image_id']) ? esc_html($_GET['image_id']) : '0');
45
  ?>
46
  <div style="display:table; width:100%; height:<?php echo $popup_height; ?>px;">
66
  window.document.getElementById("bwg_container_for_media_1").innerHTML = spider_display_embed(file_type, embed_id, {class:"embed_display", width:"<?php echo $image_width; ?>", height:"<?php echo $image_height; ?>", frameborder:"0", allowfullscreen:"allowfullscreen", style:"width:<?php echo $image_width; ?>px; height:<?php echo $image_height; ?>px; vertical-align:middle; text-align: center; margin: 0 auto;" });
67
  }
68
  else{
69
+ window.document.getElementById("bwg_container_for_media_1").innerHTML = spider_display_embed(file_type, embed_id, {class:"embed_display", width:"<?php echo $instagram_post_width; ?>", height:"<?php echo $instagram_post_height; ?>", frameborder:"0", allowfullscreen:"allowfullscreen", style:"width:<?php echo $instagram_post_width ; ?>px; height:<?php echo $instagram_post_height; ?>px; vertical-align:middle; text-align: center; margin: 0 auto;" });
70
  }
71
  }
72
  </script>
admin/views/BWGViewGalleries_bwg.php CHANGED
@@ -895,9 +895,22 @@ class BWGViewGalleries_bwg {
895
  <td class="table_small_col"><?php echo ++$i; ?></td>
896
  <td class="table_extra_large_col">
897
  <?php
898
- $query_url = add_query_arg(array('action' => 'editThumb', 'type' => 'display'/*thumb_display*/, 'image_id' => $row_data->id, 'width' => '800', 'height' => '500'), admin_url('admin-ajax.php'));
 
 
 
 
 
 
 
 
 
 
 
 
899
  $query_url = wp_nonce_url( $query_url, 'editThumb', 'bwg_nonce' );
900
  $query_url = add_query_arg(array('TB_iframe' => '1'), $query_url);
 
901
  ?>
902
  <a class="thickbox thickbox-preview" title="<?php echo $row_data->alt; ?>" href="<?php echo $query_url; ?>">
903
  <img id="image_thumb_<?php echo $row_data->id; ?>" class="thumb" src="<?php echo (!$is_embed ? site_url() . '/' . $WD_BWG_UPLOAD_DIR : "") . $row_data->thumb_url . ($is_embed ? '' : '?date=' . date('Y-m-y H:i:s')); ?>" />
895
  <td class="table_small_col"><?php echo ++$i; ?></td>
896
  <td class="table_extra_large_col">
897
  <?php
898
+ $is_embed_instagram_post = preg_match('/INSTAGRAM_POST/', $row_data->filetype) == 1 ? true :false;
899
+ $instagram_post_width = 0;
900
+ $instagram_post_height = 0;
901
+ if ($is_embed_instagram_post) {
902
+ $image_resolution = explode(' x ', $row_data->resolution);
903
+ if (is_array($image_resolution)) {
904
+ $instagram_post_width = $image_resolution[0];
905
+ $instagram_post_height = explode(' ', $image_resolution[1]);
906
+ $instagram_post_height = $instagram_post_height[0];
907
+ }
908
+ }
909
+
910
+ $query_url = add_query_arg(array('action' => 'editThumb', 'type' => 'display'/*thumb_display*/, 'image_id' => $row_data->id, 'width' => '800', 'height' => '500', 'instagram_post_width' => $instagram_post_width, 'instagram_post_height' => $instagram_post_height), admin_url('admin-ajax.php'));
911
  $query_url = wp_nonce_url( $query_url, 'editThumb', 'bwg_nonce' );
912
  $query_url = add_query_arg(array('TB_iframe' => '1'), $query_url);
913
+ $is_embed_instagram_post = preg_match('/INSTAGRAM_POST/',$row_data->filetype) == 1 ? true : false;
914
  ?>
915
  <a class="thickbox thickbox-preview" title="<?php echo $row_data->alt; ?>" href="<?php echo $query_url; ?>">
916
  <img id="image_thumb_<?php echo $row_data->id; ?>" class="thumb" src="<?php echo (!$is_embed ? site_url() . '/' . $WD_BWG_UPLOAD_DIR : "") . $row_data->thumb_url . ($is_embed ? '' : '?date=' . date('Y-m-y H:i:s')); ?>" />
framework/WDWLibrary.php CHANGED
@@ -622,25 +622,23 @@ class WDWLibrary {
622
  }
623
  spider_frontend_ajax('<?php echo $form_id; ?>', '<?php echo $current_view; ?>', '<?php echo $id; ?>', '<?php echo $album_gallery_id; ?>', '', '<?php echo $type; ?>', 0, '', '', load_more);
624
  }
625
- jQuery(document).ready(function() {
626
- jQuery('.<?php echo $first_page; ?>').on('click', function() {
627
- spider_page_<?php echo $current_view; ?>(this, <?php echo $page_number; ?>, -2);
628
- });
629
- jQuery('.<?php echo $prev_page; ?>').on('click', function() {
630
- spider_page_<?php echo $current_view; ?>(this, <?php echo $page_number; ?>, -1);
631
- return false;
632
- });
633
- jQuery('.<?php echo $next_page; ?>').on('click', function() {
634
- spider_page_<?php echo $current_view; ?>(this, <?php echo $page_number; ?>, 1);
635
- return false;
636
- });
637
- jQuery('.<?php echo $last_page; ?>').on('click', function() {
638
- spider_page_<?php echo $current_view; ?>(this, <?php echo $page_number; ?>, 2);
639
- });
640
- jQuery('.bwg_load_btn_<?php echo $current_view; ?>').on('click', function() {
641
- spider_page_<?php echo $current_view; ?>(this, <?php echo $page_number; ?>, 1, true);
642
- return false;
643
- });
644
  });
645
  </script>
646
  </span>
622
  }
623
  spider_frontend_ajax('<?php echo $form_id; ?>', '<?php echo $current_view; ?>', '<?php echo $id; ?>', '<?php echo $album_gallery_id; ?>', '', '<?php echo $type; ?>', 0, '', '', load_more);
624
  }
625
+ jQuery('.<?php echo $first_page; ?>').on('click', function() {
626
+ spider_page_<?php echo $current_view; ?>(this, <?php echo $page_number; ?>, -2);
627
+ });
628
+ jQuery('.<?php echo $prev_page; ?>').on('click', function() {
629
+ spider_page_<?php echo $current_view; ?>(this, <?php echo $page_number; ?>, -1);
630
+ return false;
631
+ });
632
+ jQuery('.<?php echo $next_page; ?>').on('click', function() {
633
+ spider_page_<?php echo $current_view; ?>(this, <?php echo $page_number; ?>, 1);
634
+ return false;
635
+ });
636
+ jQuery('.<?php echo $last_page; ?>').on('click', function() {
637
+ spider_page_<?php echo $current_view; ?>(this, <?php echo $page_number; ?>, 2);
638
+ });
639
+ jQuery('.bwg_load_btn_<?php echo $current_view; ?>').on('click', function() {
640
+ spider_page_<?php echo $current_view; ?>(this, <?php echo $page_number; ?>, 1, true);
641
+ return false;
 
 
642
  });
643
  </script>
644
  </span>
framework/WDWLibraryEmbed.php CHANGED
@@ -145,8 +145,7 @@ class WDWLibraryEmbed {
145
  if(empty($result)){
146
  return json_encode(array("error", wp_remote_retrieve_body($get_embed_data)));
147
  }
148
-
149
-
150
  $embedData = array(
151
  'name' => htmlspecialchars($result->title),
152
  'description' => htmlspecialchars($result->title),
@@ -158,7 +157,7 @@ class WDWLibraryEmbed {
158
  'size' => '',
159
  'filetype' => $embed_type,
160
  'date_modified' => date('d F Y, H:i'),
161
- 'resolution' => $result->thumbnail_width." x ".$result->thumbnail_height." px",
162
  'redirect_url' => ''
163
  );
164
 
@@ -217,8 +216,8 @@ class WDWLibraryEmbed {
217
  $result = json_decode(wp_remote_retrieve_body($get_embed_data));
218
  if(empty($result)){
219
  return json_encode(array("error", wp_remote_retrieve_body($get_embed_data)));
220
- }
221
-
222
  $embedData = array(
223
  'name' => htmlspecialchars($result->title),
224
  'description' => htmlspecialchars($result->title),
@@ -230,7 +229,7 @@ class WDWLibraryEmbed {
230
  'size' => '',
231
  'filetype' => $embed_type,
232
  'date_modified' => date('d F Y, H:i'),
233
- 'resolution' => $result->width." x ".$result->width." px",
234
  'redirect_url' => '');
235
 
236
  return json_encode($embedData);
@@ -485,7 +484,7 @@ class WDWLibraryEmbed {
485
  if(preg_match('/src/i', $attr)===0){
486
  if($attr != '' && $value != ''){
487
  $oembed_instagram_html .= ' '. $attr . '="'. $value . '"';
488
- if($attr == 'class' || $attr =='CLASS' || $attr =='Class'){
489
  $class = $value;
490
  }
491
  }
145
  if(empty($result)){
146
  return json_encode(array("error", wp_remote_retrieve_body($get_embed_data)));
147
  }
148
+ list($img_width, $img_height) = @getimagesize('https://instagram.com/p/' . $filename . '/media/?size=l');
 
149
  $embedData = array(
150
  'name' => htmlspecialchars($result->title),
151
  'description' => htmlspecialchars($result->title),
157
  'size' => '',
158
  'filetype' => $embed_type,
159
  'date_modified' => date('d F Y, H:i'),
160
+ 'resolution' => $img_width . " x " . $img_height . " px",
161
  'redirect_url' => ''
162
  );
163
 
216
  $result = json_decode(wp_remote_retrieve_body($get_embed_data));
217
  if(empty($result)){
218
  return json_encode(array("error", wp_remote_retrieve_body($get_embed_data)));
219
+ }
220
+ list($img_width, $img_height) = @getimagesize('https://instagram.com/p/' . $filename . '/media/?size=l');
221
  $embedData = array(
222
  'name' => htmlspecialchars($result->title),
223
  'description' => htmlspecialchars($result->title),
229
  'size' => '',
230
  'filetype' => $embed_type,
231
  'date_modified' => date('d F Y, H:i'),
232
+ 'resolution' => $img_width . " x " . $img_height . " px",
233
  'redirect_url' => '');
234
 
235
  return json_encode($embedData);
484
  if(preg_match('/src/i', $attr)===0){
485
  if($attr != '' && $value != ''){
486
  $oembed_instagram_html .= ' '. $attr . '="'. $value . '"';
487
+ if(strtolower($attr) == 'class') {
488
  $class = $value;
489
  }
490
  }
frontend/views/BWGViewAlbum_compact_preview.php CHANGED
@@ -751,24 +751,32 @@ class BWGViewAlbum_compact_preview {
751
  }
752
  }
753
  foreach ($image_rows as $image_row) {
754
- $is_embed = preg_match('/EMBED/',$image_row->filetype)==1 ? true :false;
755
- $is_embed_video = preg_match('/VIDEO/',$image_row->filetype)==1 ? true :false;
 
756
  if (!$is_embed) {
757
  list($image_thumb_width, $image_thumb_height) = getimagesize(htmlspecialchars_decode(ABSPATH . $WD_BWG_UPLOAD_DIR . $image_row->thumb_url, ENT_COMPAT | ENT_QUOTES));
758
  }
759
  else {
760
  if ($image_row->resolution != '') {
761
- $resolution_arr = explode(" ",$image_row->resolution);
762
- $resolution_w = intval($resolution_arr[0]);
763
- $resolution_h = intval($resolution_arr[2]);
764
- if($resolution_w != 0 && $resolution_h != 0){
765
- $scale = $scale = max($params['compuct_album_image_thumb_width'] / $resolution_w, $params['compuct_album_image_thumb_height'] / $resolution_h);
766
- $image_thumb_width = $resolution_w * $scale;
767
- $image_thumb_height = $resolution_h * $scale;
 
 
 
 
 
 
768
  }
769
- else{
770
- $image_thumb_width = $params['compuct_album_image_thumb_width'];
771
- $image_thumb_height = $params['compuct_album_image_thumb_height'];
 
772
  }
773
  }
774
  else{
751
  }
752
  }
753
  foreach ($image_rows as $image_row) {
754
+ $is_embed = preg_match('/EMBED/', $image_row->filetype) == 1 ? true : false;
755
+ $is_embed_video = preg_match('/VIDEO/', $image_row->filetype) == 1 ? true : false;
756
+ $is_embed_instagram = preg_match('/EMBED_OEMBED_INSTAGRAM/', $image_row->filetype) == 1 ? true : false;
757
  if (!$is_embed) {
758
  list($image_thumb_width, $image_thumb_height) = getimagesize(htmlspecialchars_decode(ABSPATH . $WD_BWG_UPLOAD_DIR . $image_row->thumb_url, ENT_COMPAT | ENT_QUOTES));
759
  }
760
  else {
761
  if ($image_row->resolution != '') {
762
+ if (!$is_embed_instagram) {
763
+ $resolution_arr = explode(" ", $image_row->resolution);
764
+ $resolution_w = intval($resolution_arr[0]);
765
+ $resolution_h = intval($resolution_arr[2]);
766
+ if($resolution_w != 0 && $resolution_h != 0){
767
+ $scale = $scale = max($params['compuct_album_image_thumb_width'] / $resolution_w, $params['compuct_album_image_thumb_height'] / $resolution_h);
768
+ $image_thumb_width = $resolution_w * $scale;
769
+ $image_thumb_height = $resolution_h * $scale;
770
+ }
771
+ else{
772
+ $image_thumb_width = $params['compuct_album_image_thumb_width'];
773
+ $image_thumb_height = $params['compuct_album_image_thumb_height'];
774
+ }
775
  }
776
+ else {
777
+ // this will be ok while instagram thumbnails width and height are the same
778
+ $image_thumb_width = min($params['compuct_album_image_thumb_width'], $params['compuct_album_image_thumb_height']);
779
+ $image_thumb_height = $image_thumb_width;
780
  }
781
  }
782
  else{
frontend/views/BWGViewAlbum_extended_preview.php CHANGED
@@ -732,30 +732,38 @@ class BWGViewAlbum_extended_preview {
732
  }
733
  }
734
  foreach ($image_rows as $image_row) {
735
- $is_embed = preg_match('/EMBED/',$image_row->filetype)==1 ? true :false;
736
- $is_embed_video = preg_match('/VIDEO/',$image_row->filetype)==1 ? true :false;
 
737
  if (!$is_embed) {
738
  list($image_thumb_width, $image_thumb_height) = getimagesize(htmlspecialchars_decode(ABSPATH . $WD_BWG_UPLOAD_DIR . $image_row->thumb_url, ENT_COMPAT | ENT_QUOTES));
739
  }
740
  else {
741
- if($image_row->resolution != ''){
742
- $resolution_arr = explode(" ",$image_row->resolution);
743
- $resolution_w = intval($resolution_arr[0]);
744
- $resolution_h = intval($resolution_arr[2]);
745
- if($resolution_w != 0 && $resolution_h != 0){
746
- $scale = $scale = max($params['extended_album_image_thumb_width'] / $resolution_w, $params['extended_album_image_thumb_height'] / $resolution_h);
747
- $image_thumb_width = $resolution_w * $scale;
748
- $image_thumb_height = $resolution_h * $scale;
 
 
 
 
 
 
749
  }
750
- else{
751
- $image_thumb_width = $params['extended_album_image_thumb_width'];
752
- $image_thumb_height = $params['extended_album_image_thumb_height'];
 
753
  }
754
  }
755
  else{
756
  $image_thumb_width = $params['extended_album_image_thumb_width'];
757
  $image_thumb_height = $params['extended_album_image_thumb_height'];
758
- }
759
  }
760
  $scale = max($params['extended_album_image_thumb_width'] / $image_thumb_width, $params['extended_album_image_thumb_height'] / $image_thumb_height);
761
  $image_thumb_width *= $scale;
732
  }
733
  }
734
  foreach ($image_rows as $image_row) {
735
+ $is_embed = preg_match('/EMBED/', $image_row->filetype) == 1 ? true : false;
736
+ $is_embed_video = preg_match('/VIDEO/', $image_row->filetype) == 1 ? true : false;
737
+ $is_embed_instagram = preg_match('/EMBED_OEMBED_INSTAGRAM/', $image_row->filetype) == 1 ? true : false;
738
  if (!$is_embed) {
739
  list($image_thumb_width, $image_thumb_height) = getimagesize(htmlspecialchars_decode(ABSPATH . $WD_BWG_UPLOAD_DIR . $image_row->thumb_url, ENT_COMPAT | ENT_QUOTES));
740
  }
741
  else {
742
+ if($image_row->resolution != '') {
743
+ if (!$is_embed_instagram) {
744
+ $resolution_arr = explode(" ",$image_row->resolution);
745
+ $resolution_w = intval($resolution_arr[0]);
746
+ $resolution_h = intval($resolution_arr[2]);
747
+ if($resolution_w != 0 && $resolution_h != 0){
748
+ $scale = $scale = max($params['extended_album_image_thumb_width'] / $resolution_w, $params['extended_album_image_thumb_height'] / $resolution_h);
749
+ $image_thumb_width = $resolution_w * $scale;
750
+ $image_thumb_height = $resolution_h * $scale;
751
+ }
752
+ else{
753
+ $image_thumb_width = $params['extended_album_image_thumb_width'];
754
+ $image_thumb_height = $params['extended_album_image_thumb_height'];
755
+ }
756
  }
757
+ else {
758
+ // this will be ok while instagram thumbnails width and height are the same
759
+ $image_thumb_width = min($params['extended_album_image_thumb_width'], $params['extended_album_image_thumb_height']);
760
+ $image_thumb_height = $image_thumb_width;
761
  }
762
  }
763
  else{
764
  $image_thumb_width = $params['extended_album_image_thumb_width'];
765
  $image_thumb_height = $params['extended_album_image_thumb_height'];
766
+ }
767
  }
768
  $scale = max($params['extended_album_image_thumb_width'] / $image_thumb_width, $params['extended_album_image_thumb_height'] / $image_thumb_height);
769
  $image_thumb_width *= $scale;
frontend/views/BWGViewGalleryBox.php CHANGED
@@ -738,6 +738,16 @@ class BWGViewGalleryBox {
738
  data["<?php echo $key; ?>"]["id"] = "<?php echo $image_row->id; ?>";
739
  data["<?php echo $key; ?>"]["alt"] = "<?php echo str_replace(array("\r\n", "\n", "\r"), esc_html('<br />'), $image_row->alt); ?>";
740
  data["<?php echo $key; ?>"]["description"] = "<?php echo str_replace(array("\r\n", "\n", "\r"), esc_html('<br />'), $image_row->description); ?>";
 
 
 
 
 
 
 
 
 
 
741
  data["<?php echo $key; ?>"]["image_url"] = "<?php echo $image_row->image_url; ?>";
742
  data["<?php echo $key; ?>"]["thumb_url"] = "<?php echo $image_row->thumb_url; ?>";
743
  data["<?php echo $key; ?>"]["date"] = "<?php echo $image_row->date; ?>";
@@ -887,16 +897,26 @@ class BWGViewGalleryBox {
887
  else { /*$is_embed*/ ?>
888
  <span class="bwg_popup_embed bwg_popup_watermark" style="diplay: table; table-layout: fixed;">
889
  <?php
890
- if($is_embed_instagram_post){
891
- $post_width = $image_width - ($filmstrip_direction == 'vertical' ? $image_filmstrip_width : 0);
892
- $post_height = $image_height - ($filmstrip_direction == 'horizontal' ? $image_filmstrip_height : 0);
893
- if($post_height <$post_width +88 ){
894
- $post_width =$post_height -88;
895
  }
896
- else{
897
- $post_height =$post_width +88;
 
 
 
 
 
 
 
 
 
898
  }
899
- WDWLibraryEmbed::display_embed($image_row->filetype, $image_row->filename, array('class'=>"bwg_embed_frame", 'frameborder'=>"0", 'style'=>"width:".$post_width."px; height:".$post_height."px; vertical-align:middle; display:inline-block; position:relative;"));
 
900
  }
901
  else{
902
  WDWLibraryEmbed::display_embed($image_row->filetype, $image_row->filename, array('class'=>"bwg_embed_frame", 'frameborder'=>"0", 'allowfullscreen'=>"allowfullscreen", 'style'=>"width:inherit; height:inherit; vertical-align:middle; display:table-cell;"));
@@ -1371,18 +1391,18 @@ class BWGViewGalleryBox {
1371
  else { /*is_embed*/
1372
 
1373
  innhtml += '<span style="height: ' + cur_height + 'px; width: ' + cur_width + 'px;" class="bwg_popup_embed bwg_popup_watermark">';
1374
- if(is_embed_instagram_post){
1375
- var post_width = 0;
1376
- var post_height = 0;
1377
- if(cur_height <cur_width +88 ){
1378
- post_height = cur_height;
1379
- post_width = post_height -88;
1380
- }
1381
- else{
1382
- post_width = cur_width;
1383
- post_height = post_width +88 ;
1384
- }
1385
- innhtml += spider_display_embed(data[key]['filetype'], data[key]['filename'], {class:"bwg_embed_frame", frameborder:"0", allowfullscreen:"allowfullscreen", style:"width:"+post_width+"px; height:"+post_height+"px; vertical-align:middle; display:inline-block; position:relative; top: "+0.5*(cur_height-post_height)+ "px; " });
1386
  }
1387
  else{
1388
  innhtml += spider_display_embed(data[key]['filetype'], data[key]['filename'], {class:"bwg_embed_frame", frameborder:"0", allowfullscreen:"allowfullscreen", style:"width:inherit; height:inherit; vertical-align:middle; display:table-cell;" });
@@ -1448,6 +1468,7 @@ class BWGViewGalleryBox {
1448
  <?php
1449
  }
1450
  ?>
 
1451
  }
1452
  if (!is_embed) {
1453
  var cur_img = jQuery(next_image_class).find('img');
@@ -1548,7 +1569,6 @@ class BWGViewGalleryBox {
1548
  jQuery(".bwg_popup_embed").css({
1549
  height: <?php echo $image_height - $image_filmstrip_height; ?>
1550
  });
1551
- bwg_resize_instagram_post();
1552
  bwg_popup_current_height = <?php echo $image_height; ?>;
1553
  }
1554
  else {
@@ -1565,7 +1585,6 @@ class BWGViewGalleryBox {
1565
  jQuery(".bwg_popup_embed").css({
1566
  height: jQuery(window).height() - <?php echo $image_filmstrip_height; ?>
1567
  });
1568
- bwg_resize_instagram_post();
1569
  bwg_popup_current_height = jQuery(window).height();
1570
  }
1571
  if (!(!(jQuery(window).width() >= <?php echo $image_width; ?>) || !(<?php echo $open_with_fullscreen; ?> != 1))) {
@@ -1576,13 +1595,13 @@ class BWGViewGalleryBox {
1576
  zIndex: 100000
1577
  });
1578
  jQuery(".bwg_image_wrap").css({width: <?php echo $image_width; ?> - comment_container_width});
 
1579
  jQuery(".bwg_popup_image").css({
1580
  maxWidth: <?php echo $image_width; ?> - comment_container_width
1581
  });
1582
  jQuery(".bwg_popup_embed").css({
1583
  width: <?php echo $image_width; ?> - comment_container_width
1584
  });
1585
- bwg_resize_instagram_post();
1586
  jQuery(".bwg_filmstrip_container").css({width: <?php echo $image_width; ?> - comment_container_width});
1587
  jQuery(".bwg_filmstrip").css({width: (<?php echo $image_width; ?> - comment_container_width- 40)});
1588
  bwg_popup_current_width = <?php echo $image_width; ?>;
@@ -1595,18 +1614,19 @@ class BWGViewGalleryBox {
1595
  zIndex: 100000
1596
  });
1597
  jQuery(".bwg_image_wrap").css({width: (jQuery(window).width() - comment_container_width)});
 
1598
  jQuery(".bwg_popup_image").css({
1599
  maxWidth: jQuery(window).width() - comment_container_width
1600
  });
1601
  jQuery(".bwg_popup_embed").css({
1602
  width: jQuery(window).width() - comment_container_width
1603
  });
1604
- bwg_resize_instagram_post();
1605
  jQuery(".bwg_filmstrip_container").css({width: (jQuery(window).width() - comment_container_width)});
1606
  jQuery(".bwg_filmstrip").css({width: (jQuery(window).width() - comment_container_width - 40)});
1607
  bwg_popup_current_width = jQuery(window).width();
1608
  }
1609
  /* Set watermark container size.*/
 
1610
  bwg_change_watermark_container();
1611
  if (!(!(jQuery(window).height() > <?php echo $image_height - 2 * $theme_row->lightbox_close_btn_top; ?>) || !(jQuery(window).width() >= <?php echo $image_width - 2 * $theme_row->lightbox_close_btn_right; ?>) || !(<?php echo $open_with_fullscreen; ?> != 1))) {
1612
  jQuery(".spider_popup_close_fullscreen").attr("class", "spider_popup_close");
@@ -2215,37 +2235,22 @@ class BWGViewGalleryBox {
2215
  jQuery(".spider_popup_close").attr("class", "bwg_ctrl_btn spider_popup_close_fullscreen");
2216
  }
2217
 
2218
- function bwg_resize_instagram_post(){
2219
- jQuery('.bwg_embed_frame').css({'width':'inherit', 'height':'inherit', 'vertical-align':'middle', 'display':'inline-block'});
2220
- /*jQuery.fn.exists = function(){return this.length>0;}*/
2221
  if (jQuery('.inner_instagram_iframe_bwg_embed_frame').length) {
2222
- var w = jQuery(".bwg_popup_embed").width();
2223
- var h = jQuery(".bwg_popup_embed").height();
2224
- var post_width = 0;
2225
- var post_height = 0;
2226
-
2227
- if(h <w +88 ){
2228
- post_height = h;
2229
- post_width = h -88;
2230
- }
2231
- else{
2232
- post_width = w;
2233
- post_height = w +88 ;
2234
- }
2235
 
2236
- jQuery('.inner_instagram_iframe_bwg_embed_frame').each(function(){
2237
-
2238
- post_height = post_height;
2239
- post_width = post_width;
2240
- var top_pos = (0.5 *( h-post_height));
2241
- jQuery(this).parent().css({
2242
- height: post_height,
2243
- width: post_width,
2244
- top: top_pos
2245
- });
2246
  });
2247
-
2248
-
2249
  bwg_change_watermark_container();
2250
  }
2251
  }
738
  data["<?php echo $key; ?>"]["id"] = "<?php echo $image_row->id; ?>";
739
  data["<?php echo $key; ?>"]["alt"] = "<?php echo str_replace(array("\r\n", "\n", "\r"), esc_html('<br />'), $image_row->alt); ?>";
740
  data["<?php echo $key; ?>"]["description"] = "<?php echo str_replace(array("\r\n", "\n", "\r"), esc_html('<br />'), $image_row->description); ?>";
741
+ <?php
742
+ $image_resolution = explode(' x ', $image_row->resolution);
743
+ if (is_array($image_resolution)) {
744
+ $instagram_post_width = $image_resolution[0];
745
+ $instagram_post_height = explode(' ', $image_resolution[1]);
746
+ $instagram_post_height = $instagram_post_height[0];
747
+ }
748
+ ?>
749
+ data["<?php echo $key; ?>"]["image_width"] = "<?php echo $instagram_post_width; ?>";
750
+ data["<?php echo $key; ?>"]["image_height"] = "<?php echo $instagram_post_height; ?>";
751
  data["<?php echo $key; ?>"]["image_url"] = "<?php echo $image_row->image_url; ?>";
752
  data["<?php echo $key; ?>"]["thumb_url"] = "<?php echo $image_row->thumb_url; ?>";
753
  data["<?php echo $key; ?>"]["date"] = "<?php echo $image_row->date; ?>";
897
  else { /*$is_embed*/ ?>
898
  <span class="bwg_popup_embed bwg_popup_watermark" style="diplay: table; table-layout: fixed;">
899
  <?php
900
+ if ($is_embed_instagram_post) {
901
+ $post_width = $image_width;
902
+ $post_height = $image_height;
903
+ if ($post_height < $post_width + 88) {
904
+ $post_width = $post_height - 88;
905
  }
906
+ else {
907
+ $post_height = $post_width + 88;
908
+ }
909
+
910
+ $instagram_post_width = $post_width;
911
+ $instagram_post_height = $post_height;
912
+ $image_resolution = explode(' x ', $image_row->resolution);
913
+ if (is_array($image_resolution)) {
914
+ $instagram_post_width = $image_resolution[0];
915
+ $instagram_post_height = explode(' ', $image_resolution[1]);
916
+ $instagram_post_height = $instagram_post_height[0];
917
  }
918
+
919
+ WDWLibraryEmbed::display_embed($image_row->filetype, $image_row->filename, array('class' => "bwg_embed_frame", 'data-width' => $instagram_post_width, 'data-height' => $instagram_post_height, 'frameborder' => "0", 'style' => "width:" . $post_width . "px; height:" . $post_height . "px; vertical-align:middle; display:inline-block; position:relative;"));
920
  }
921
  else{
922
  WDWLibraryEmbed::display_embed($image_row->filetype, $image_row->filename, array('class'=>"bwg_embed_frame", 'frameborder'=>"0", 'allowfullscreen'=>"allowfullscreen", 'style'=>"width:inherit; height:inherit; vertical-align:middle; display:table-cell;"));
1391
  else { /*is_embed*/
1392
 
1393
  innhtml += '<span style="height: ' + cur_height + 'px; width: ' + cur_width + 'px;" class="bwg_popup_embed bwg_popup_watermark">';
1394
+ if (is_embed_instagram_post) {
1395
+ var post_width = 0;
1396
+ var post_height = 0;
1397
+ if (cur_height < cur_width + 88) {
1398
+ post_height = cur_height;
1399
+ post_width = post_height - 88;
1400
+ }
1401
+ else {
1402
+ post_width = cur_width;
1403
+ post_height = post_width + 88;
1404
+ }
1405
+ innhtml += spider_display_embed(data[key]['filetype'], data[key]['filename'], {class:"bwg_embed_frame", 'data-width': data[key]['image_width'], 'data-height': data[key]['image_height'], frameborder: "0", allowfullscreen: "allowfullscreen", style: "width:" + post_width + "px; height:" + post_height + "px; vertical-align:middle; display:inline-block; position:relative; top: " + 0.5 * (cur_height - post_height) + "px;"});
1406
  }
1407
  else{
1408
  innhtml += spider_display_embed(data[key]['filetype'], data[key]['filename'], {class:"bwg_embed_frame", frameborder:"0", allowfullscreen:"allowfullscreen", style:"width:inherit; height:inherit; vertical-align:middle; display:table-cell;" });
1468
  <?php
1469
  }
1470
  ?>
1471
+ bwg_resize_instagram_post();
1472
  }
1473
  if (!is_embed) {
1474
  var cur_img = jQuery(next_image_class).find('img');
1569
  jQuery(".bwg_popup_embed").css({
1570
  height: <?php echo $image_height - $image_filmstrip_height; ?>
1571
  });
 
1572
  bwg_popup_current_height = <?php echo $image_height; ?>;
1573
  }
1574
  else {
1585
  jQuery(".bwg_popup_embed").css({
1586
  height: jQuery(window).height() - <?php echo $image_filmstrip_height; ?>
1587
  });
 
1588
  bwg_popup_current_height = jQuery(window).height();
1589
  }
1590
  if (!(!(jQuery(window).width() >= <?php echo $image_width; ?>) || !(<?php echo $open_with_fullscreen; ?> != 1))) {
1595
  zIndex: 100000
1596
  });
1597
  jQuery(".bwg_image_wrap").css({width: <?php echo $image_width; ?> - comment_container_width});
1598
+ jQuery(".bwg_image_container").css({width: <?php echo $image_width; ?> - comment_container_width});
1599
  jQuery(".bwg_popup_image").css({
1600
  maxWidth: <?php echo $image_width; ?> - comment_container_width
1601
  });
1602
  jQuery(".bwg_popup_embed").css({
1603
  width: <?php echo $image_width; ?> - comment_container_width
1604
  });
 
1605
  jQuery(".bwg_filmstrip_container").css({width: <?php echo $image_width; ?> - comment_container_width});
1606
  jQuery(".bwg_filmstrip").css({width: (<?php echo $image_width; ?> - comment_container_width- 40)});
1607
  bwg_popup_current_width = <?php echo $image_width; ?>;
1614
  zIndex: 100000
1615
  });
1616
  jQuery(".bwg_image_wrap").css({width: (jQuery(window).width() - comment_container_width)});
1617
+ jQuery(".bwg_image_container").css({width: <?php echo $image_width; ?> - comment_container_width});
1618
  jQuery(".bwg_popup_image").css({
1619
  maxWidth: jQuery(window).width() - comment_container_width
1620
  });
1621
  jQuery(".bwg_popup_embed").css({
1622
  width: jQuery(window).width() - comment_container_width
1623
  });
 
1624
  jQuery(".bwg_filmstrip_container").css({width: (jQuery(window).width() - comment_container_width)});
1625
  jQuery(".bwg_filmstrip").css({width: (jQuery(window).width() - comment_container_width - 40)});
1626
  bwg_popup_current_width = jQuery(window).width();
1627
  }
1628
  /* Set watermark container size.*/
1629
+ bwg_resize_instagram_post();
1630
  bwg_change_watermark_container();
1631
  if (!(!(jQuery(window).height() > <?php echo $image_height - 2 * $theme_row->lightbox_close_btn_top; ?>) || !(jQuery(window).width() >= <?php echo $image_width - 2 * $theme_row->lightbox_close_btn_right; ?>) || !(<?php echo $open_with_fullscreen; ?> != 1))) {
1632
  jQuery(".spider_popup_close_fullscreen").attr("class", "spider_popup_close");
2235
  jQuery(".spider_popup_close").attr("class", "bwg_ctrl_btn spider_popup_close_fullscreen");
2236
  }
2237
 
2238
+ function bwg_resize_instagram_post() {
 
 
2239
  if (jQuery('.inner_instagram_iframe_bwg_embed_frame').length) {
2240
+ var post_width = jQuery(".bwg_image_container").width();
2241
+ var post_height = jQuery(".bwg_image_container").height();
 
 
 
 
 
 
 
 
 
 
 
2242
 
2243
+ jQuery('.inner_instagram_iframe_bwg_embed_frame').each(function() {
2244
+ var parent_container = jQuery(this).parent();
2245
+ if (post_height / (parseInt(parent_container.attr('data-height')) + 96) < post_width / parseInt(parent_container.attr('data-width'))) {
2246
+ parent_container.height(post_height);
2247
+ parent_container.width((parent_container.height() - 96) * parent_container.attr('data-width') / parent_container.attr('data-height') + 16);
2248
+ }
2249
+ else {
2250
+ parent_container.width(post_width);
2251
+ parent_container.height((parent_container.width() - 16) * parent_container.attr('data-height') / parent_container.attr('data-width') + 96);
2252
+ }
2253
  });
 
 
2254
  bwg_change_watermark_container();
2255
  }
2256
  }
frontend/views/BWGViewImage_browser.php CHANGED
@@ -507,8 +507,16 @@ class BWGViewImage_browser {
507
  if($is_embed_16x9){
508
  WDWLibraryEmbed::display_embed($image_row->filetype, $image_row->filename, array('id'=>"bwg_embed_frame_16x9_".$bwg,'width'=>$params['image_browser_width'], 'height'=>$params['image_browser_width']*0.5625, 'frameborder'=>"0", 'allowfullscreen'=>"allowfullscreen", 'style'=>"position: relative; margin:0;"));
509
  }
510
- elseif($is_embed_instagram_post){
511
- WDWLibraryEmbed::display_embed($image_row->filetype, $image_row->filename, array('id'=>"bwg_embed_frame_instapost_".$bwg,'width'=>$params['image_browser_width'], 'height'=>$params['image_browser_width']+88, 'frameborder'=>"0", 'allowfullscreen'=>"allowfullscreen", 'style'=>"position: relative; margin:0;"));
 
 
 
 
 
 
 
 
512
  }
513
  else{/*for instagram image, video and flickr enable lightbox onclick*/
514
  ?>
@@ -527,7 +535,9 @@ class BWGViewImage_browser {
527
  jQuery('#bwg_embed_frame_16x9_<?php echo $bwg; ?>').width(jQuery('#bwg_embed_frame_16x9_<?php echo $bwg; ?>').parent().width());
528
  jQuery('#bwg_embed_frame_16x9_<?php echo $bwg; ?>').height(jQuery('#bwg_embed_frame_16x9_<?php echo $bwg; ?>').width() * 0.5625);
529
  jQuery('#bwg_embed_frame_instapost_<?php echo $bwg; ?>').width(jQuery('#bwg_embed_frame_16x9_<?php echo $bwg; ?>').parent().width());
530
- jQuery('#bwg_embed_frame_instapost_<?php echo $bwg; ?>').height(jQuery('#bwg_embed_frame_instapost_<?php echo $bwg; ?>').width() +88);
 
 
531
 
532
  var bwg_image_browser_width = jQuery('.image_browser_images_<?php echo $bwg; ?>').width();
533
  if (bwg_image_browser_width <= 108) {
507
  if($is_embed_16x9){
508
  WDWLibraryEmbed::display_embed($image_row->filetype, $image_row->filename, array('id'=>"bwg_embed_frame_16x9_".$bwg,'width'=>$params['image_browser_width'], 'height'=>$params['image_browser_width']*0.5625, 'frameborder'=>"0", 'allowfullscreen'=>"allowfullscreen", 'style'=>"position: relative; margin:0;"));
509
  }
510
+ else if($is_embed_instagram_post) {
511
+ $instagram_post_width = $params['image_browser_width'];
512
+ $instagram_post_height = $params['image_browser_width'];
513
+ $image_resolution = explode(' x ', $image_row->resolution);
514
+ if (is_array($image_resolution)) {
515
+ $instagram_post_width = $image_resolution[0];
516
+ $instagram_post_height = explode(' ', $image_resolution[1]);
517
+ $instagram_post_height = $instagram_post_height[0];
518
+ }
519
+ WDWLibraryEmbed::display_embed($image_row->filetype, $image_row->filename, array('class' => "bwg_embed_frame_instapost_" . $bwg, 'data-width' => $instagram_post_width, 'data-height' => $instagram_post_height, 'frameborder' => "0", 'allowfullscreen' => "allowfullscreen", 'style' => "position: relative; margin:0;"));
520
  }
521
  else{/*for instagram image, video and flickr enable lightbox onclick*/
522
  ?>
535
  jQuery('#bwg_embed_frame_16x9_<?php echo $bwg; ?>').width(jQuery('#bwg_embed_frame_16x9_<?php echo $bwg; ?>').parent().width());
536
  jQuery('#bwg_embed_frame_16x9_<?php echo $bwg; ?>').height(jQuery('#bwg_embed_frame_16x9_<?php echo $bwg; ?>').width() * 0.5625);
537
  jQuery('#bwg_embed_frame_instapost_<?php echo $bwg; ?>').width(jQuery('#bwg_embed_frame_16x9_<?php echo $bwg; ?>').parent().width());
538
+ /* 16 is 2*padding inside iframe */
539
+ /* 96 is 2*padding(top) + 1*padding(bottom) + 40(footer) + 32(header) */
540
+ jQuery('.bwg_embed_frame_instapost_<?php echo $bwg; ?>').height((jQuery('.bwg_embed_frame_instapost_<?php echo $bwg; ?>').width() - 16) * jQuery('.bwg_embed_frame_instapost_<?php echo $bwg; ?>').attr('data-height') / jQuery('.bwg_embed_frame_instapost_<?php echo $bwg; ?>').attr('data-width') + 96);
541
 
542
  var bwg_image_browser_width = jQuery('.image_browser_images_<?php echo $bwg; ?>').width();
543
  if (bwg_image_browser_width <= 108) {
frontend/views/BWGViewSlideshow.php CHANGED
@@ -677,16 +677,26 @@ class BWGViewSlideshow {
677
  else{ /*$is_embed*/?>
678
  <span id="bwg_slideshow_image_<?php echo $bwg; ?>" class="bwg_slideshow_embed_<?php echo $bwg; ?>" image_id="<?php echo $image_row->id; ?>">
679
  <?php
680
- if($is_embed_instagram_post){
681
- $post_width = $image_width - ($filmstrip_direction == 'vertical' ? $slideshow_filmstrip_width : 0);
682
- $post_height = $image_height - ($filmstrip_direction == 'horizontal' ? $slideshow_filmstrip_height : 0);
683
- if($post_height <$post_width +88 ){
684
- $post_width =$post_height -88;
685
  }
686
- else{
687
- $post_height =$post_width +88;
 
 
 
 
 
 
 
 
 
688
  }
689
- WDWLibraryEmbed::display_embed($image_row->filetype, $image_row->filename, array('class'=>"bwg_embed_frame_".$bwg, 'frameborder'=>"0", 'style'=>"width:".$post_width."px; height:".$post_height."px; vertical-align:middle; display:inline-block; position:relative;"));
 
690
  }
691
  else{
692
  WDWLibraryEmbed::display_embed($image_row->filetype, $image_row->filename, array('class'=>"bwg_embed_frame_".$bwg, 'frameborder'=>"0", 'allowfullscreen'=>"allowfullscreen", 'style'=>"width:inherit; height:inherit; vertical-align:middle; display:table-cell;"));
@@ -717,15 +727,25 @@ class BWGViewSlideshow {
717
  <span class="bwg_slideshow_embed_<?php echo $bwg; ?>">
718
  <?php
719
  if($is_embed_instagram_post){
720
- $post_width = $image_width - ($filmstrip_direction == 'vertical' ? $slideshow_filmstrip_width : 0);
721
- $post_height = $image_height - ($filmstrip_direction == 'horizontal' ? $slideshow_filmstrip_height : 0);
722
- if($post_height < $post_width +88 ){
723
- $post_width = $post_height - 88;
724
  }
725
  else{
726
- $post_height =$post_width +88;
727
  }
728
- WDWLibraryEmbed::display_embed($image_row->filetype, $image_row->filename, array('class'=>"bwg_embed_frame_".$bwg, 'frameborder'=>"0", 'style'=>"width:".$post_width."px; height:".$post_height."px; vertical-align:middle; display:inline-block; position:relative;"));
 
 
 
 
 
 
 
 
 
 
729
  }
730
  else{
731
  WDWLibraryEmbed::display_embed($image_row->filetype, $image_row->filename, array('class'=>"bwg_embed_frame_".$bwg, 'frameborder'=>"0", 'allowfullscreen'=>"allowfullscreen", 'style'=>"width:inherit; height:inherit; vertical-align:middle; display:table-cell;"));
@@ -1460,37 +1480,20 @@ class BWGViewSlideshow {
1460
  jQuery(".bwg_slideshow_image_<?php echo $bwg; ?>").removeAttr("width");
1461
  jQuery(".bwg_slideshow_image_<?php echo $bwg; ?>").removeAttr("height");
1462
  });
1463
- function bwg_resize_instagram_post_<?php echo $bwg?>(){
1464
-
1465
- /*jQuery.fn.exists = function(){return this.length>0;};*/
1466
  if (jQuery('.inner_instagram_iframe_bwg_embed_frame_<?php echo $bwg?>').length) {
1467
-
1468
- var w = jQuery('.bwg_slideshow_embed_<?php echo $bwg?>').width();
1469
- var h = jQuery('.bwg_slideshow_embed_<?php echo $bwg?>').height();
1470
- var post_width = 0;
1471
- var post_height = 0;
1472
- if(h <w +88 ){
1473
- post_height = h;
1474
- post_width = h -88;
1475
- }
1476
- else{
1477
- post_width = w;
1478
- post_height = w +88 ;
1479
- }
1480
- jQuery('.inner_instagram_iframe_bwg_embed_frame_<?php echo $bwg?>').each(function(){
1481
- post_height = post_height;
1482
- post_width = post_width;
1483
- var top_pos = (0.5 *( h-post_height));
1484
- jQuery(this).parent().parent().css({
1485
- height: post_height,
1486
- width: post_width,
1487
- top: top_pos
1488
- });
1489
- jQuery(this).parent().css({
1490
- height: post_height,
1491
- width: post_width,
1492
- top: top_pos
1493
- });
1494
  });
1495
  }
1496
  bwg_change_watermark_container_<?php echo $bwg; ?>();
677
  else{ /*$is_embed*/?>
678
  <span id="bwg_slideshow_image_<?php echo $bwg; ?>" class="bwg_slideshow_embed_<?php echo $bwg; ?>" image_id="<?php echo $image_row->id; ?>">
679
  <?php
680
+ if($is_embed_instagram_post) {
681
+ $post_width = $image_width;
682
+ $post_height = $image_height;
683
+ if ($post_height < $post_width + 88) {
684
+ $post_width = $post_height - 88;
685
  }
686
+ else {
687
+ $post_height = $post_width + 88;
688
+ }
689
+
690
+ $instagram_post_width = $post_width;
691
+ $instagram_post_height = $post_height;
692
+ $image_resolution = explode(' x ', $image_row->resolution);
693
+ if (is_array($image_resolution)) {
694
+ $instagram_post_width = $image_resolution[0];
695
+ $instagram_post_height = explode(' ', $image_resolution[1]);
696
+ $instagram_post_height = $instagram_post_height[0];
697
  }
698
+
699
+ WDWLibraryEmbed::display_embed($image_row->filetype, $image_row->filename, array('class' => "bwg_embed_frame_" . $bwg, 'data-width' => $instagram_post_width, 'data-height' => $instagram_post_height, 'frameborder' => "0", 'style' => "width:" . $post_width . "px; height:" . $post_height . "px; vertical-align:middle; display:inline-block; position:relative;"));
700
  }
701
  else{
702
  WDWLibraryEmbed::display_embed($image_row->filetype, $image_row->filename, array('class'=>"bwg_embed_frame_".$bwg, 'frameborder'=>"0", 'allowfullscreen'=>"allowfullscreen", 'style'=>"width:inherit; height:inherit; vertical-align:middle; display:table-cell;"));
727
  <span class="bwg_slideshow_embed_<?php echo $bwg; ?>">
728
  <?php
729
  if($is_embed_instagram_post){
730
+ $post_width = $image_width;
731
+ $post_height = $image_height;
732
+ if($post_height < $post_width + 88) {
733
+ $post_width = $post_height - 88;
734
  }
735
  else{
736
+ $post_height = $post_width + 88;
737
  }
738
+
739
+ $instagram_post_width = $post_width;
740
+ $instagram_post_height = $post_height;
741
+ $image_resolution = explode(' x ', $image_row->resolution);
742
+ if (is_array($image_resolution)) {
743
+ $instagram_post_width = $image_resolution[0];
744
+ $instagram_post_height = explode(' ', $image_resolution[1]);
745
+ $instagram_post_height = $instagram_post_height[0];
746
+ }
747
+
748
+ WDWLibraryEmbed::display_embed($image_row->filetype, $image_row->filename, array('class'=>"bwg_embed_frame_".$bwg, 'data-width' => $instagram_post_width, 'data-height' => $instagram_post_height, 'frameborder'=>"0", 'style'=>"width:".$post_width."px; height:".$post_height."px; vertical-align:middle; display:inline-block; position:relative;"));
749
  }
750
  else{
751
  WDWLibraryEmbed::display_embed($image_row->filetype, $image_row->filename, array('class'=>"bwg_embed_frame_".$bwg, 'frameborder'=>"0", 'allowfullscreen'=>"allowfullscreen", 'style'=>"width:inherit; height:inherit; vertical-align:middle; display:table-cell;"));
1480
  jQuery(".bwg_slideshow_image_<?php echo $bwg; ?>").removeAttr("width");
1481
  jQuery(".bwg_slideshow_image_<?php echo $bwg; ?>").removeAttr("height");
1482
  });
1483
+ function bwg_resize_instagram_post_<?php echo $bwg?>() {
 
 
1484
  if (jQuery('.inner_instagram_iframe_bwg_embed_frame_<?php echo $bwg?>').length) {
1485
+ var post_width = jQuery('.bwg_slideshow_embed_<?php echo $bwg?>').width();
1486
+ var post_height = jQuery('.bwg_slideshow_embed_<?php echo $bwg?>').height();
1487
+ jQuery('.inner_instagram_iframe_bwg_embed_frame_<?php echo $bwg?>').each(function() {
1488
+ var parent_container = jQuery(this).parent();
1489
+ if (post_height / (parseInt(parent_container.attr('data-height')) + 96) < post_width / parseInt(parent_container.attr('data-width'))) {
1490
+ parent_container.height(post_height);
1491
+ parent_container.width((parent_container.height() - 96) * parent_container.attr('data-width') / parent_container.attr('data-height') + 16);
1492
+ }
1493
+ else {
1494
+ parent_container.width(post_width);
1495
+ parent_container.height((parent_container.width() - 16) * parent_container.attr('data-height') / parent_container.attr('data-width') + 96);
1496
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1497
  });
1498
  }
1499
  bwg_change_watermark_container_<?php echo $bwg; ?>();
frontend/views/BWGViewThumbnails.php CHANGED
@@ -403,23 +403,31 @@ class BWGViewThumbnails {
403
  foreach ($image_rows as $image_row) {
404
  $is_embed = preg_match('/EMBED/',$image_row->filetype)==1 ? true :false;
405
  $is_embed_video = preg_match('/VIDEO/',$image_row->filetype)==1 ? true :false;
 
406
  if (!$is_embed) {
407
  list($image_thumb_width, $image_thumb_height) = getimagesize(htmlspecialchars_decode(ABSPATH . $WD_BWG_UPLOAD_DIR . $image_row->thumb_url, ENT_COMPAT | ENT_QUOTES));
408
  }
409
  else {
410
  $image_thumb_width = $params['thumb_width'];
411
  if($image_row->resolution != ''){
412
- $resolution_arr = explode(" ",$image_row->resolution);
413
- $resolution_w = intval($resolution_arr[0]);
414
- $resolution_h = intval($resolution_arr[2]);
415
- if($resolution_w != 0 && $resolution_h != 0){
416
- $scale = $scale = max($params['thumb_width'] / $resolution_w, $params['thumb_height'] / $resolution_h);
417
- $image_thumb_width = $resolution_w * $scale;
418
- $image_thumb_height = $resolution_h * $scale;
 
 
 
 
 
 
419
  }
420
- else{
421
- $image_thumb_width = $params['thumb_width'];
422
- $image_thumb_height = $params['thumb_height'];
 
423
  }
424
  }
425
  else{
403
  foreach ($image_rows as $image_row) {
404
  $is_embed = preg_match('/EMBED/',$image_row->filetype)==1 ? true :false;
405
  $is_embed_video = preg_match('/VIDEO/',$image_row->filetype)==1 ? true :false;
406
+ $is_embed_instagram = preg_match('/EMBED_OEMBED_INSTAGRAM/',$image_row->filetype)==1 ? true : false;
407
  if (!$is_embed) {
408
  list($image_thumb_width, $image_thumb_height) = getimagesize(htmlspecialchars_decode(ABSPATH . $WD_BWG_UPLOAD_DIR . $image_row->thumb_url, ENT_COMPAT | ENT_QUOTES));
409
  }
410
  else {
411
  $image_thumb_width = $params['thumb_width'];
412
  if($image_row->resolution != ''){
413
+ if (!$is_embed_instagram) {
414
+ $resolution_arr = explode(" ", $image_row->resolution);
415
+ $resolution_w = intval($resolution_arr[0]);
416
+ $resolution_h = intval($resolution_arr[2]);
417
+ if($resolution_w != 0 && $resolution_h != 0){
418
+ $scale = $scale = max($params['thumb_width'] / $resolution_w, $params['thumb_height'] / $resolution_h);
419
+ $image_thumb_width = $resolution_w * $scale;
420
+ $image_thumb_height = $resolution_h * $scale;
421
+ }
422
+ else{
423
+ $image_thumb_width = $params['thumb_width'];
424
+ $image_thumb_height = $params['thumb_height'];
425
+ }
426
  }
427
+ else {
428
+ // this will be ok while instagram thumbnails width and height are the same
429
+ $image_thumb_width = min($params['thumb_width'], $params['thumb_height']);
430
+ $image_thumb_height = $image_thumb_width;
431
  }
432
  }
433
  else{
js/bwg_frontend.js CHANGED
@@ -98,13 +98,17 @@ function spider_frontend_ajax(form_id, current_view, id, album_gallery_id, cur_a
98
  });
99
  jQuery(".blog_style_images_conteiner_" + current_view + " .bwg_embed_frame_instapost_" + current_view).each(function (e) {
100
  jQuery(this).width(jQuery(this).parent().width());
101
- jQuery(this).height(jQuery(this).width() +88);
 
 
102
  });
103
  /* For Image browser view.*/
104
- jQuery('#bwg_embed_frame_16x9_'+current_view).width(jQuery('#bwg_embed_frame_16x9_'+current_view).parent().width());
105
- jQuery('#bwg_embed_frame_16x9_'+current_view).height(jQuery('#bwg_embed_frame_16x9_'+current_view).width() * 0.5625);
106
- jQuery('#bwg_embed_frame_instapost_'+current_view).width(jQuery('#bwg_embed_frame_16x9_'+current_view).parent().width());
107
- jQuery('#bwg_embed_frame_instapost_'+current_view).height(jQuery('#bwg_embed_frame_instapost_'+current_view).width() +88);
 
 
108
  });
109
  // if (event.preventDefault) {
110
  // event.preventDefault();
98
  });
99
  jQuery(".blog_style_images_conteiner_" + current_view + " .bwg_embed_frame_instapost_" + current_view).each(function (e) {
100
  jQuery(this).width(jQuery(this).parent().width());
101
+ /* 16 is 2*padding inside iframe */
102
+ /* 96 is 2*padding(top) + 1*padding(bottom) + 40(footer) + 32(header) */
103
+ jQuery(this).height((jQuery(this).width() - 16) * jQuery(this).attr('data-height') / jQuery(this).attr('data-width') + 96);
104
  });
105
  /* For Image browser view.*/
106
+ jQuery('#bwg_embed_frame_16x9_' + current_view).width(jQuery('#bwg_embed_frame_16x9_' + current_view).parent().width());
107
+ jQuery('#bwg_embed_frame_16x9_' + current_view).height(jQuery('#bwg_embed_frame_16x9_' + current_view).width() * 0.5625);
108
+ jQuery('#bwg_embed_frame_instapost_' + current_view).width(jQuery('#bwg_embed_frame_16x9_' + current_view).parent().width());
109
+ /* 16 is 2*padding inside iframe */
110
+ /* 96 is 2*padding(top) + 1*padding(bottom) + 40(footer) + 32(header) */
111
+ jQuery('.bwg_embed_frame_instapost_' + current_view).height((jQuery('.bwg_embed_frame_instapost_' + current_view).width() - 16) * jQuery('.bwg_embed_frame_instapost_' + current_view).attr('data-height') / jQuery('.bwg_embed_frame_instapost_' + current_view).attr('data-width') + 96);
112
  });
113
  // if (event.preventDefault) {
114
  // event.preventDefault();
photo-gallery.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin Name: Photo Gallery
5
  * Plugin URI: https://web-dorado.com/products/wordpress-photo-gallery-plugin.html
6
  * Description: This plugin is a fully responsive gallery plugin with advanced functionality. It allows having different image galleries for your posts and pages. You can create unlimited number of galleries, combine them into albums, and provide descriptions and tags.
7
- * Version: 1.2.105
8
  * Author: WebDorado
9
  * Author URI: https://web-dorado.com/
10
  * License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
@@ -14,6 +14,7 @@ define('WD_BWG_DIR', WP_PLUGIN_DIR . "/" . plugin_basename(dirname(__FILE__)));
14
  define('WD_BWG_URL', plugins_url(plugin_basename(dirname(__FILE__))));
15
  define('WD_BWG_NAME', plugin_basename(dirname(__FILE__)));
16
  define('WD_BWG_PRO', false);
 
17
 
18
  function bwg_use_home_url() {
19
  $home_url = str_replace("http://", "", home_url());
@@ -1922,8 +1923,8 @@ function bwg_activate() {
1922
  'default_theme' => 0
1923
  ));
1924
  }
1925
- $version = get_option("wd_bwg_version");
1926
- $new_version = '1.2.105';
1927
  if ($version && version_compare($version, $new_version, '<')) {
1928
  require_once WD_BWG_DIR . "/update/bwg_update.php";
1929
  bwg_update($version);
@@ -1976,8 +1977,8 @@ add_action('wpmu_new_blog', 'bwg_new_blog_added', 10, 6);
1976
  wp_oembed_add_provider( '#https://instagr(\.am|am\.com)/p/.*#i', 'https://api.instagram.com/oembed', true );
1977
 
1978
  function bwg_update_hook() {
1979
- $version = get_option("wd_bwg_version");
1980
- $new_version = '1.2.105';
1981
  if ($version && version_compare($version, $new_version, '<')) {
1982
  require_once WD_BWG_DIR . "/update/bwg_update.php";
1983
  bwg_update($version);
@@ -2331,7 +2332,7 @@ function bwg_captcha() {
2331
  }
2332
 
2333
  function wd_bwg_version() {
2334
- $version = get_option("wd_bwg_version");
2335
  if ($version) {
2336
  if (WD_BWG_PRO) {
2337
  $version = substr_replace($version, '2', 0, 1);
4
  * Plugin Name: Photo Gallery
5
  * Plugin URI: https://web-dorado.com/products/wordpress-photo-gallery-plugin.html
6
  * Description: This plugin is a fully responsive gallery plugin with advanced functionality. It allows having different image galleries for your posts and pages. You can create unlimited number of galleries, combine them into albums, and provide descriptions and tags.
7
+ * Version: 1.2.106
8
  * Author: WebDorado
9
  * Author URI: https://web-dorado.com/
10
  * License: GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html
14
  define('WD_BWG_URL', plugins_url(plugin_basename(dirname(__FILE__))));
15
  define('WD_BWG_NAME', plugin_basename(dirname(__FILE__)));
16
  define('WD_BWG_PRO', false);
17
+ define('WD_BWG_VERSION', get_option('wd_bwg_version'));
18
 
19
  function bwg_use_home_url() {
20
  $home_url = str_replace("http://", "", home_url());
1923
  'default_theme' => 0
1924
  ));
1925
  }
1926
+ $version = WD_BWG_VERSION;
1927
+ $new_version = '1.2.106';
1928
  if ($version && version_compare($version, $new_version, '<')) {
1929
  require_once WD_BWG_DIR . "/update/bwg_update.php";
1930
  bwg_update($version);
1977
  wp_oembed_add_provider( '#https://instagr(\.am|am\.com)/p/.*#i', 'https://api.instagram.com/oembed', true );
1978
 
1979
  function bwg_update_hook() {
1980
+ $version = WD_BWG_VERSION;
1981
+ $new_version = '1.2.106';
1982
  if ($version && version_compare($version, $new_version, '<')) {
1983
  require_once WD_BWG_DIR . "/update/bwg_update.php";
1984
  bwg_update($version);
2332
  }
2333
 
2334
  function wd_bwg_version() {
2335
+ $version = WD_BWG_VERSION;
2336
  if ($version) {
2337
  if (WD_BWG_PRO) {
2338
  $version = substr_replace($version, '2', 0, 1);
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://web-dorado.com/products/wordpress-photo-gallery-plugin.html
4
  Tags: photo, photo gallery, image gallery, video gallery, gallery, galleries, wordpress gallery plugin, images gallery, album, photo albums, simple gallery, best gallery plugin, free photo gallery, wp gallery, wordpress gallery, website gallery, gallery shortcode, best gallery, picture, pictures, gallery slider, photo album, photogallery, widget gallery, image, images, photos, gallery lightbox, photoset, wordpress photo gallery plugin, wp gallery plugins, responsive wordpress photo gallery, media, image album, filterable gallery, banner rotator, fullscreen gallery, responsive gallery, add album, add gallery, add pictures, fotoalbum, foto, gallery decription, multiple pictures, photoalbum, upload images, upload photos, view images, view pictures, admin, AJAX, comments, gallery image, image lightbox, image rotate, image slideshow, image slider, jquery, jquery gallery, slide show, slideshow, thumbnail, thumbnail view, thumbnails, thumbs, responsive, watermarking, watermarks,fullscreen slider, lightbox, photography, sidebar, slide, youtube, vimeo, videos, instagram, facebook, mosaic, facebook integration, instagram feed, Flickr, Dailymotion, widget, youtube gallery, ecommerce
5
  Requires at least: 3.4
6
  Tested up to: 4.5
7
- Stable tag: 1.2.105
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -225,6 +225,11 @@ To enable the feature of adding Media Library images, go to Photo Gallery > Opti
225
 
226
  == Changelog ==
227
 
 
 
 
 
 
228
  = 1.2.105 =
229
  * Changed: Deleted themes old fields.
230
  * Changed: Check if file exist on set watermark.
4
  Tags: photo, photo gallery, image gallery, video gallery, gallery, galleries, wordpress gallery plugin, images gallery, album, photo albums, simple gallery, best gallery plugin, free photo gallery, wp gallery, wordpress gallery, website gallery, gallery shortcode, best gallery, picture, pictures, gallery slider, photo album, photogallery, widget gallery, image, images, photos, gallery lightbox, photoset, wordpress photo gallery plugin, wp gallery plugins, responsive wordpress photo gallery, media, image album, filterable gallery, banner rotator, fullscreen gallery, responsive gallery, add album, add gallery, add pictures, fotoalbum, foto, gallery decription, multiple pictures, photoalbum, upload images, upload photos, view images, view pictures, admin, AJAX, comments, gallery image, image lightbox, image rotate, image slideshow, image slider, jquery, jquery gallery, slide show, slideshow, thumbnail, thumbnail view, thumbnails, thumbs, responsive, watermarking, watermarks,fullscreen slider, lightbox, photography, sidebar, slide, youtube, vimeo, videos, instagram, facebook, mosaic, facebook integration, instagram feed, Flickr, Dailymotion, widget, youtube gallery, ecommerce
5
  Requires at least: 3.4
6
  Tested up to: 4.5
7
+ Stable tag: 1.2.106
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
225
 
226
  == Changelog ==
227
 
228
+ = 1.2.106 =
229
+ IMPORTANT: Instagram changed the API. You need to get a new access token by using "Sign in with Instagram" button on the Options page in order to keep your Instagram Gallery functioning after June 1.
230
+ * Changed: Instagram new API.
231
+ * Changed: Increase get_options count.
232
+
233
  = 1.2.105 =
234
  * Changed: Deleted themes old fields.
235
  * Changed: Check if file exist on set watermark.