Featured Image From URL - Version 3.8.3

Version Description

  • Fix: CDN + Optimized thumbnails (not working for images loaded via ajax); fix: Hide Featured Media (no images in related posts); fix: conflict with BuddyBoss App (lightbox not opening); fix: conflict with Wolmart theme (fatal error).
Download this release

Release Info

Developer marceljm
Plugin Icon 128x128 Featured Image From URL
Version 3.8.3
Comparing to
See all releases

Code changes from version 3.8.2 to 3.8.3

admin/column.php CHANGED
@@ -14,6 +14,10 @@ function fifu_column() {
14
  }
15
 
16
  function fifu_admin_add_css_js() {
 
 
 
 
17
  wp_enqueue_style('fifu-pro-css', plugins_url('/html/css/pro.css', __FILE__), array(), fifu_version_number());
18
  wp_enqueue_style('fancy-box-css', 'https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.5.7/jquery.fancybox.css');
19
  wp_enqueue_script('fancy-box-js', 'https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.5.7/jquery.fancybox.min.js');
14
  }
15
 
16
  function fifu_admin_add_css_js() {
17
+ // buddyboss app
18
+ if (isset($_REQUEST['page']) && strpos($_REQUEST['page'], 'bbapp') !== false)
19
+ return;
20
+
21
  wp_enqueue_style('fifu-pro-css', plugins_url('/html/css/pro.css', __FILE__), array(), fifu_version_number());
22
  wp_enqueue_style('fancy-box-css', 'https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.5.7/jquery.fancybox.css');
23
  wp_enqueue_script('fancy-box-js', 'https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.5.7/jquery.fancybox.min.js');
admin/html/meta-box.html CHANGED
@@ -88,7 +88,7 @@
88
  </div>
89
 
90
  <div id="fifu_premium" style="<?php echo $show_button ?>">
91
- <table style="position: relative; top: 11px; background-color: #444444; color:white; width: 100%; border-radius: 5px">
92
  <tr style="text-align: center;">
93
  <td style="font-size: 12px; background-color: #007cba; border-radius: 3px"><a style="color:white; text-decoration: none" target="_blank" href="/wp-admin/admin.php?page=fifu-cloud" title="Click here to know more and suggest a price">Know <b>FIFU Cloud</b></a></td>
94
  <td style="padding: 0px 0px" class="fifu-hover"><span title="Save local or external images in the Google Cloud Storage. Never lose an image again." class="dashicons dashicons-open-folder" style="font-size:20px; display: unset; vertical-align:sub;"></span></td>
@@ -96,9 +96,9 @@
96
  <td style="padding: 0px 0px" class="fifu-hover"><span title="Process images 100% in the Google Cloud servers. Don't torture your website anymore." class="dashicons dashicons-cloud-saved" style="font-size:20px; display: unset; vertical-align:sub;"></span></td>
97
  <td style="padding: 0px 0px" class="fifu-hover"><span title="Pay per stored image. Please access the link and suggest a fair price." class="dashicons dashicons-money-alt" style="font-size:20px; display: unset; vertical-align:sub;"></span></td>
98
  </tr>
99
- </table>
100
 
101
- <!-- <table style="position: relative; top: 11px; background-color: #444444; color:white; width: 100%; border-radius: 5px">
102
  <tr style="text-align: center;">
103
  <td style="width: 90px; font-size: 11px; background-color: #1da867; border-radius: 3px"><a style="color:white; text-decoration: none" target="_blank" href="https://fifu.app/" title="Unlock all features">Go <b>PRO</b></a></td>
104
  <td style="padding: 0px 0px" class="fifu-hover"><span title="Featured video" class="dashicons dashicons-video-alt3" style="font-size:15px; display: unset; vertical-align:sub;"></span></td>
@@ -110,10 +110,8 @@
110
  <td style="padding: 0px 0px" class="fifu-hover"><span title="ISBN (Auto set featured image using ISBN and books API)" class="dashicons dashicons-book-alt" style="font-size:15px; display: unset; vertical-align:sub;"></span></td>
111
  <td style="padding: 0px 0px" class="fifu-hover"><span title="Screenshot (Auto set screenshot as featured image)" class="dashicons dashicons-cover-image" style="font-size:15px; display: unset; vertical-align:sub;"></span></td>
112
  <td style="padding: 0px 0px" class="fifu-hover"><span title="Media finder (Auto set featured image/video using web page address)" class="dashicons dashicons-search" style="font-size:15px; display: unset; vertical-align:sub;"></span></td>
113
- <td style="padding: 0px 0px" class="fifu-hover"><span title="Tags (Auto set featured image from Unsplash using tags)" class="dashicons dashicons-tag" style="font-size:15px; display: unset; vertical-align:sub;"></span></td>
114
- <td style="padding: 0px 0px" class="fifu-hover"><span title="Featured image/video (for bbPress forms)" class="dashicons dashicons-buddicons-bbpress-logo" style="font-size:15px; display: unset; vertical-align:sub;"></span></td>
115
  </tr>
116
- </table> -->
117
  </div>
118
 
119
  </div>
88
  </div>
89
 
90
  <div id="fifu_premium" style="<?php echo $show_button ?>">
91
+ <!-- <table style="position: relative; top: 11px; background-color: #444444; color:white; width: 100%; border-radius: 5px">
92
  <tr style="text-align: center;">
93
  <td style="font-size: 12px; background-color: #007cba; border-radius: 3px"><a style="color:white; text-decoration: none" target="_blank" href="/wp-admin/admin.php?page=fifu-cloud" title="Click here to know more and suggest a price">Know <b>FIFU Cloud</b></a></td>
94
  <td style="padding: 0px 0px" class="fifu-hover"><span title="Save local or external images in the Google Cloud Storage. Never lose an image again." class="dashicons dashicons-open-folder" style="font-size:20px; display: unset; vertical-align:sub;"></span></td>
96
  <td style="padding: 0px 0px" class="fifu-hover"><span title="Process images 100% in the Google Cloud servers. Don't torture your website anymore." class="dashicons dashicons-cloud-saved" style="font-size:20px; display: unset; vertical-align:sub;"></span></td>
97
  <td style="padding: 0px 0px" class="fifu-hover"><span title="Pay per stored image. Please access the link and suggest a fair price." class="dashicons dashicons-money-alt" style="font-size:20px; display: unset; vertical-align:sub;"></span></td>
98
  </tr>
99
+ </table> -->
100
 
101
+ <table style="position: relative; top: 11px; background-color: #444444; color:white; width: 100%; border-radius: 5px">
102
  <tr style="text-align: center;">
103
  <td style="width: 90px; font-size: 11px; background-color: #1da867; border-radius: 3px"><a style="color:white; text-decoration: none" target="_blank" href="https://fifu.app/" title="Unlock all features">Go <b>PRO</b></a></td>
104
  <td style="padding: 0px 0px" class="fifu-hover"><span title="Featured video" class="dashicons dashicons-video-alt3" style="font-size:15px; display: unset; vertical-align:sub;"></span></td>
110
  <td style="padding: 0px 0px" class="fifu-hover"><span title="ISBN (Auto set featured image using ISBN and books API)" class="dashicons dashicons-book-alt" style="font-size:15px; display: unset; vertical-align:sub;"></span></td>
111
  <td style="padding: 0px 0px" class="fifu-hover"><span title="Screenshot (Auto set screenshot as featured image)" class="dashicons dashicons-cover-image" style="font-size:15px; display: unset; vertical-align:sub;"></span></td>
112
  <td style="padding: 0px 0px" class="fifu-hover"><span title="Media finder (Auto set featured image/video using web page address)" class="dashicons dashicons-search" style="font-size:15px; display: unset; vertical-align:sub;"></span></td>
 
 
113
  </tr>
114
+ </table>
115
  </div>
116
 
117
  </div>
admin/html/troubleshooting.html CHANGED
@@ -9,6 +9,62 @@
9
  <div id="tabs-top" style="float:left">
10
  <ul>
11
  <div id="tabs-t" style="padding:1em 1.4em; position: relative; top: -25px;">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
  <div class="box">
13
  <table>
14
  <tr>
@@ -58,7 +114,7 @@
58
  </tr>
59
  </table>
60
  <div class="greybox" style="position: relative; top: -10px">
61
- Facebook doesn't share an INTERNAL featured image and the Sharing Debugger informs: "Provided og:image URL, ... could not be processed as an image because it has an invalid content type". <br>
62
  1) make sure the image can be embedded externally. Because if your site tries to protect the image, for instance redirecting to another address, the image may not be accessed by the social media.<br>
63
  </div>
64
  </div>
@@ -258,7 +314,7 @@
258
  </table>
259
  <div class="greybox" style="position: relative; top: -10px">
260
  The featured image is being cropped when the post is shared in a Facebook page:<br>
261
- x) there is no local solution and the issue happens even with internal featured images. Facebook pages expect 600x314px images and it will automatically crop images with a different aspect ratio. You may contact Facebook support and ask for changes.<br>
262
  </div>
263
  </div>
264
  <div class="box">
@@ -535,7 +591,7 @@
535
  </tr>
536
  </table>
537
  <div class="greybox" style="position: relative; top: -10px">
538
- Removing the references to the internal featured images for all posts that have an external featured image as well:<br>
539
  1) run this SQL command: DELETE FROM wp_postmeta WHERE meta_key = '_thumbnail_id' AND post_id IN (SELECT post_id FROM (SELECT post_id FROM wp_postmeta WHERE meta_key = 'fifu_image_url') AS x);<br>
540
  2) enable "FIFU settings > Metadata > Clean Metadata";<br>
541
  3) enable "Image Metadata".<br>
9
  <div id="tabs-top" style="float:left">
10
  <ul>
11
  <div id="tabs-t" style="padding:1em 1.4em; position: relative; top: -25px;">
12
+ <div class="box">
13
+ <table>
14
+ <tr>
15
+ <td style="border-bottom:none">2022-01-28</td>
16
+ <td style="border-bottom:none"><h3>Motors – Car Dealer, Classifieds & Listing</h3></td>
17
+ <td style="border-bottom:none">plugin</td>
18
+ </tr>
19
+ </table>
20
+ <div class="greybox" style="position: relative; top: -10px">
21
+ External images not displayed:<br>
22
+ 1) open stm_vehicles_listing/includes/vehicle_functions.php<br>
23
+ 2) remove the line "add_filter('wp_get_attachment_image_src', 'stm_get_thumbnail_filter', 100, 4);"<br>
24
+ </div>
25
+ </div>
26
+ <div class="box">
27
+ <table>
28
+ <tr>
29
+ <td style="border-bottom:none">2022-01-28</td>
30
+ <td style="border-bottom:none"><h3>Motors - Equipment</h3></td>
31
+ <td style="border-bottom:none">plugin</td>
32
+ </tr>
33
+ </table>
34
+ <div class="greybox" style="position: relative; top: -10px">
35
+ External images not displayed:<br>
36
+ 1) open stm-motors-equipment/inc/helpers.php<br>
37
+ 2) remove the line "add_filter('wp_get_attachment_image_src', 'stm_equip_get_thumbnail_filter', 100, 4)"<br>
38
+ </div>
39
+ </div>
40
+ <div class="box">
41
+ <table>
42
+ <tr>
43
+ <td style="border-bottom:none">2022-01-23</td>
44
+ <td style="border-bottom:none"><h3>Imagely</h3></td>
45
+ <td style="border-bottom:none">theme</td>
46
+ </tr>
47
+ </table>
48
+ <div class="greybox" style="position: relative; top: -10px">
49
+ External images not displayed:<br>
50
+ 1) open imagely/inc/third/image-resizer.php<br>
51
+ 2) replace "throw new Reactr_Extras_Exception('Image must be local: ' . $url);" by "return $url;"<br>
52
+ </div>
53
+ </div>
54
+ <div class="box">
55
+ <table>
56
+ <tr>
57
+ <td style="border-bottom:none">2022-01-13</td>
58
+ <td style="border-bottom:none"><h3>WP All Import</h3></td>
59
+ <td style="border-bottom:none">plugin</td>
60
+ </tr>
61
+ </table>
62
+ <div class="greybox" style="position: relative; top: -10px">
63
+ Adding URLs from different elements to "Product image URL + gallery URLs". Examples:<br>
64
+ a) {images[1]/image[1]}|{images[1]/image[2]}|{images[1]/image[3]}|{images[1]/image[4]}<br>
65
+ b) [FOREACH({images/image})]{.}|[ENDFOREACH]<br>
66
+ </div>
67
+ </div>
68
  <div class="box">
69
  <table>
70
  <tr>
114
  </tr>
115
  </table>
116
  <div class="greybox" style="position: relative; top: -10px">
117
+ Facebook doesn't share an LOCAL featured image and the Sharing Debugger informs: "Provided og:image URL, ... could not be processed as an image because it has an invalid content type". <br>
118
  1) make sure the image can be embedded externally. Because if your site tries to protect the image, for instance redirecting to another address, the image may not be accessed by the social media.<br>
119
  </div>
120
  </div>
314
  </table>
315
  <div class="greybox" style="position: relative; top: -10px">
316
  The featured image is being cropped when the post is shared in a Facebook page:<br>
317
+ x) there is no local solution and the issue happens even with local featured images. Facebook pages expect 600x314px images and it will automatically crop images with a different aspect ratio. You may contact Facebook support and ask for changes.<br>
318
  </div>
319
  </div>
320
  <div class="box">
591
  </tr>
592
  </table>
593
  <div class="greybox" style="position: relative; top: -10px">
594
+ Removing the references to the local featured images for all posts that have an external featured image as well:<br>
595
  1) run this SQL command: DELETE FROM wp_postmeta WHERE meta_key = '_thumbnail_id' AND post_id IN (SELECT post_id FROM (SELECT post_id FROM wp_postmeta WHERE meta_key = 'fifu_image_url') AS x);<br>
596
  2) enable "FIFU settings > Metadata > Clean Metadata";<br>
597
  3) enable "Image Metadata".<br>
admin/strings.php CHANGED
@@ -878,7 +878,7 @@ function fifu_get_strings_settings() {
878
 
879
  // configuration
880
  $fifu['html']['desc'] = function() {
881
- _e("Set featured images/videos automatically. FIFU will read the HTML of your post and use the 1st image/video URL found as featured media. It happens when you click on Publish/Update button. Images URLs must be in \"img\" tags. And videos can only be hidden if they are in \"iframe\" tags", FIFU_SLUG);
882
  };
883
  $fifu['html']['tab']['auto'] = function() {
884
  _e("Auto set", FIFU_SLUG);
@@ -2008,5 +2008,22 @@ function fifu_get_strings_cloud() {
2008
  _e("current cost");
2009
  };
2010
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2011
  return $fifu;
2012
  }
878
 
879
  // configuration
880
  $fifu['html']['desc'] = function() {
881
+ _e("Set featured images/videos automatically. FIFU will read the HTML of your post and use the 1st image/video URL found as featured media. It happens when you click on Publish/Update button. Images URLs must be in \"img\" tags.", FIFU_SLUG);
882
  };
883
  $fifu['html']['tab']['auto'] = function() {
884
  _e("Auto set", FIFU_SLUG);
2008
  _e("current cost");
2009
  };
2010
 
2011
+ // keys
2012
+ $fifu['keys']['header'] = function() {
2013
+ _e("Multiple image selection");
2014
+ };
2015
+ $fifu['keys']['adjacent'] = function() {
2016
+ _e("Adjacent");
2017
+ };
2018
+ $fifu['keys']['non-adjacent'] = function() {
2019
+ _e("Non-adjacent");
2020
+ };
2021
+ $fifu['keys']['shift'] = function() {
2022
+ _e("click on the first image, press <b>SHIFT</b> key and hold it. While holding Shift, click on the last image.");
2023
+ };
2024
+ $fifu['keys']['ctrl'] = function() {
2025
+ _e("click on the first image, press <b>CTRL</b> key and hold it. While holding Ctrl, click each of the other images you want to select.");
2026
+ };
2027
+
2028
  return $fifu;
2029
  }
featured-image-from-url.php CHANGED
@@ -4,11 +4,11 @@
4
  * Plugin Name: Featured Image from URL (FIFU)
5
  * Plugin URI: https://fifu.app/
6
  * Description: Use an external image/video as featured image/video of a post or WooCommerce product.
7
- * Version: 3.8.2
8
  * Author: fifu.app
9
  * Author URI: https://fifu.app/
10
  * WC requires at least: 4.0
11
- * WC tested up to: 6.0
12
  * Text Domain: featured-image-from-url
13
  * License: GPLv3
14
  * License URI: https://www.gnu.org/licenses/gpl-3.0.html
4
  * Plugin Name: Featured Image from URL (FIFU)
5
  * Plugin URI: https://fifu.app/
6
  * Description: Use an external image/video as featured image/video of a post or WooCommerce product.
7
+ * Version: 3.8.3
8
  * Author: fifu.app
9
  * Author URI: https://fifu.app/
10
  * WC requires at least: 4.0
11
+ * WC tested up to: 6.1
12
  * Text Domain: featured-image-from-url
13
  * License: GPLv3
14
  * License URI: https://www.gnu.org/licenses/gpl-3.0.html
includes/attachment.php CHANGED
@@ -82,9 +82,7 @@ function fifu_replace_attachment_image_src($image, $att_id, $size) {
82
 
83
  $image[0] = fifu_process_url($image[0], $att_id);
84
 
85
- global $post;
86
-
87
- if (fifu_should_hide() && fifu_main_image_url($post->ID) == $image[0])
88
  return null;
89
 
90
  // photon
82
 
83
  $image[0] = fifu_process_url($image[0], $att_id);
84
 
85
+ if (fifu_should_hide() && fifu_main_image_url(get_queried_object_id()) == $image[0])
 
 
86
  return null;
87
 
88
  // photon
includes/html/css/lazyload.css CHANGED
@@ -15,7 +15,7 @@
15
  .lazyloading {
16
  opacity: 1;
17
  transition: opacity 300ms;
18
- background: #f7f7f7 url('../../images/loading.gif') no-repeat center;
19
  }
20
 
21
  /* remove borders */
15
  .lazyloading {
16
  opacity: 1;
17
  transition: opacity 300ms;
18
+ background: #f7f7f7 url('https://cdnjs.cloudflare.com/ajax/libs/jquery.lazyloadxt/1.1.0/loading.gif') no-repeat center;
19
  }
20
 
21
  /* remove borders */
includes/html/js/image.js CHANGED
@@ -3,7 +3,7 @@ jQuery(document).ready(function ($) {
3
  if (fifuImageVars.fifu_lazy)
4
  fifu_lazy();
5
  else {
6
- // dont lazy the top images
7
  jQuery('img').each(function (index) {
8
  if (jQuery(this).offset().top < jQuery(window).height()) {
9
  jQuery(this).removeAttr('loading');
@@ -31,6 +31,25 @@ jQuery(window).on('ajaxComplete', function () {
31
  fifu_lazy();
32
  });
33
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
  function disableClick($) {
35
  if (!fifuImageVars.fifu_woo_lbox_enabled) {
36
  firstParentClass = '';
3
  if (fifuImageVars.fifu_lazy)
4
  fifu_lazy();
5
  else {
6
+ // no WordPress lazy load for the top images
7
  jQuery('img').each(function (index) {
8
  if (jQuery(this).offset().top < jQuery(window).height()) {
9
  jQuery(this).removeAttr('loading');
31
  fifu_lazy();
32
  });
33
 
34
+ jQuery(document).ajaxSuccess(function ($) {
35
+ if (fifuImageVars.fifu_lazy)
36
+ fifu_lazy_ajax();
37
+ });
38
+
39
+ var observer = new MutationObserver(function (mutations) {
40
+ if (fifuImageVars.fifu_lazy) {
41
+ mutations.forEach(function (mutation) {
42
+ mutation.addedNodes.forEach(function (node) {
43
+ if (jQuery(node).find('img').length > 0) {
44
+ fifu_lazy_ajax();
45
+ return;
46
+ }
47
+ });
48
+ });
49
+ }
50
+ });
51
+ observer.observe(document, {attributes: false, childList: true, characterData: false, subtree: true});
52
+
53
  function disableClick($) {
54
  if (!fifuImageVars.fifu_woo_lbox_enabled) {
55
  firstParentClass = '';
includes/html/js/lazySizesConfig.js CHANGED
@@ -14,11 +14,16 @@
14
  const FIFU_PLACEHOLDER = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAJxAAAAABCAQAAADS13yAAAAAK0lEQVR42u3BIQEAAAACIP1/2hsGoAEAAAAAAAAAAAAAAAAAAAAAAADgwgCcQgACWbaCCgAAAABJRU5ErkJggg==';
15
 
16
  function fifu_lazy() {
 
 
17
  jQuery('img').each(function (index) {
 
 
 
18
  // remove wp lazy load
19
  jQuery(this).removeAttr('loading');
20
 
21
- fifu_add_placeholder(this);
22
 
23
  // dont touch on slider
24
  if (!jQuery(this).hasClass('fifu'))
@@ -28,12 +33,10 @@ function fifu_lazy() {
28
  }
29
 
30
  function fifu_add_lazyload($) {
31
- if (jQuery($).hasClass('lazyload') || jQuery($).hasClass('lazyloaded') || jQuery($).hasClass('lazyloading'))
32
- return;
33
  jQuery($).addClass('lazyload');
34
  }
35
 
36
- function fifu_add_placeholder($) {
37
  src = jQuery($).attr('src');
38
  datasrc = jQuery($).attr('data-src');
39
  if (!src && datasrc)
@@ -45,21 +48,22 @@ function fifu_add_srcset() {
45
  for (i = 0; i < types.length; i++) {
46
  // jetpack
47
  jQuery('img[' + types[i] + '*=".wp.com/"]').each(function (index) {
48
- if (jQuery(this).attr('fifu-featured')) {
49
- isMain = jQuery(this).parents('.woocommerce-product-gallery__image').length == 1;
50
- src = jQuery(this).attr(types[i])
51
- srcset = jQuery(this).attr(types[i] + 'set');
52
-
53
- if (!srcset && !isMain) {
54
- srcset = '';
55
- sizes = [75, 100, 150, 240, 320, 500, 640, 800, 1024, 1280, 1600];
56
- for (j = 0; j < sizes.length; j++) {
57
- ssl = src.includes('ssl=1') ? '&ssl=1' : '';
58
- srcset += ((j != 0) ? ', ' : '') + src.replace(src.split('?')[1], 'w=' + sizes[j] + '&resize=' + sizes[j] + ssl) + ' ' + sizes[j] + 'w';
59
- }
60
- jQuery(this).attr(types[i] + 'set', srcset);
61
- jQuery(this).attr('data-sizes', 'auto');
62
  }
 
 
63
  }
64
  });
65
  }
@@ -88,3 +92,13 @@ function fifu_get_delimiter($, attr) {
88
  function fifu_get_delimited_url(url, delimiter) {
89
  return delimiter + url + delimiter;
90
  }
 
 
 
 
 
 
 
 
 
 
14
  const FIFU_PLACEHOLDER = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAJxAAAAABCAQAAADS13yAAAAAK0lEQVR42u3BIQEAAAACIP1/2hsGoAEAAAAAAAAAAAAAAAAAAAAAAADgwgCcQgACWbaCCgAAAABJRU5ErkJggg==';
15
 
16
  function fifu_lazy() {
17
+ var phMap = new Map();
18
+
19
  jQuery('img').each(function (index) {
20
+ if (jQuery(this).hasClass('lazyload') || jQuery(this).hasClass('lazyloaded') || jQuery(this).hasClass('lazyloading'))
21
+ return;
22
+
23
  // remove wp lazy load
24
  jQuery(this).removeAttr('loading');
25
 
26
+ fifu_add_placeholder(this, phMap);
27
 
28
  // dont touch on slider
29
  if (!jQuery(this).hasClass('fifu'))
33
  }
34
 
35
  function fifu_add_lazyload($) {
 
 
36
  jQuery($).addClass('lazyload');
37
  }
38
 
39
+ function fifu_add_placeholder($, phMap) {
40
  src = jQuery($).attr('src');
41
  datasrc = jQuery($).attr('data-src');
42
  if (!src && datasrc)
48
  for (i = 0; i < types.length; i++) {
49
  // jetpack
50
  jQuery('img[' + types[i] + '*=".wp.com/"]').each(function (index) {
51
+ if (jQuery(this).attr('srcset') && jQuery(this).attr('data-srcset'))
52
+ return;
53
+
54
+ isMain = jQuery(this).parents('.woocommerce-product-gallery__image').length == 1;
55
+ src = jQuery(this).attr(types[i])
56
+ srcset = jQuery(this).attr(types[i] + 'set');
57
+
58
+ if (!srcset && !isMain) {
59
+ srcset = '';
60
+ sizes = [75, 100, 150, 240, 320, 500, 640, 800, 1024, 1280, 1600];
61
+ for (j = 0; j < sizes.length; j++) {
62
+ ssl = src.includes('ssl=1') ? '&ssl=1' : '';
63
+ srcset += ((j != 0) ? ', ' : '') + src.replace(src.split('?')[1], 'w=' + sizes[j] + '&resize=' + sizes[j] + ssl) + ' ' + sizes[j] + 'w';
 
64
  }
65
+ jQuery(this).attr(types[i] + 'set', srcset);
66
+ jQuery(this).attr('data-sizes', 'auto');
67
  }
68
  });
69
  }
92
  function fifu_get_delimited_url(url, delimiter) {
93
  return delimiter + url + delimiter;
94
  }
95
+
96
+ function fifu_lazy_ajax() {
97
+ jQuery('img').each(function () {
98
+ if (jQuery(this).hasClass('lazyload') || jQuery(this).hasClass('lazyloaded') || jQuery(this).hasClass('lazyloading'))
99
+ return;
100
+ jQuery(this).attr('data-src', jQuery(this).attr('src'));
101
+ jQuery(this).removeAttr('src');
102
+ });
103
+ fifu_lazy();
104
+ }
includes/jetpack.php CHANGED
@@ -4,6 +4,17 @@ define('FIFU_JETPACK_SIZES', serialize(array(75, 100, 150, 240, 320, 500, 640, 8
4
 
5
  function fifu_resize_jetpack_image_size($size, $url) {
6
  $size = (int) $size;
 
 
 
 
 
 
 
 
 
 
 
7
  return "{$url}?w={$size}&resize={$size}";
8
  }
9
 
4
 
5
  function fifu_resize_jetpack_image_size($size, $url) {
6
  $size = (int) $size;
7
+
8
+ if (strpos($url, 'resize=')) {
9
+ $aux = explode('resize=', $url)[1];
10
+ $aux = explode(',', $aux);
11
+ $w = (int) $aux[0];
12
+ $h = (int) $aux[1];
13
+ $new_h = intval($size * $h / $w);
14
+ $clean_url = explode('?', $url)[0];
15
+ return "{$clean_url}?resize={$size},{$new_h}";
16
+ }
17
+
18
  return "{$url}?w={$size}&resize={$size}";
19
  }
20
 
includes/thumbnail.php CHANGED
@@ -104,7 +104,7 @@ function fifu_woo_replace($html, $product, $woosize) {
104
 
105
  add_filter('post_thumbnail_html', 'fifu_replace', 10, 5);
106
 
107
- function fifu_replace($html, $post_id, $post_thumbnail_id, $size, $attr) {
108
  if (!$html)
109
  return $html;
110
 
104
 
105
  add_filter('post_thumbnail_html', 'fifu_replace', 10, 5);
106
 
107
+ function fifu_replace($html, $post_id, $post_thumbnail_id, $size, $attr=null) {
108
  if (!$html)
109
  return $html;
110
 
includes/woo.php CHANGED
@@ -12,8 +12,8 @@ function fifu_woo_theme() {
12
  return file_exists(get_template_directory() . '/woocommerce');
13
  }
14
 
15
- define('FIFU_FIX_IMAGES_WITHOUT_DIMENSIONS', "
16
- function fix_images_without_dimensions() {
17
  jQuery('img[data-large_image_height=0]').each(function () {
18
  if (jQuery(this)[0].naturalWidth <= 2)
19
  return;
@@ -21,6 +21,8 @@ define('FIFU_FIX_IMAGES_WITHOUT_DIMENSIONS', "
21
  jQuery(this)
22
  .attr('data-large_image_width', jQuery(this)[0].naturalWidth)
23
  .attr('data-large_image_height', jQuery(this)[0].naturalHeight);
 
 
24
  });
25
  }
26
  fix_images_without_dimensions();"
12
  return file_exists(get_template_directory() . '/woocommerce');
13
  }
14
 
15
+ define('FIFU_FIX_IMAGES_WITHOUT_DIMENSIONS',
16
+ "function fix_images_without_dimensions() {
17
  jQuery('img[data-large_image_height=0]').each(function () {
18
  if (jQuery(this)[0].naturalWidth <= 2)
19
  return;
21
  jQuery(this)
22
  .attr('data-large_image_width', jQuery(this)[0].naturalWidth)
23
  .attr('data-large_image_height', jQuery(this)[0].naturalHeight);
24
+
25
+ jQuery('div.flex-viewport').css('height', jQuery(this)[0].clientHeight);
26
  });
27
  }
28
  fix_images_without_dimensions();"
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: marceljm
3
  Donate link: https://donorbox.org/fifu
4
  Tags: featured, image, url, video, woocommerce
5
  Requires at least: 5.3
6
- Tested up to: 5.8.3
7
- Stable tag: 3.8.2
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -226,20 +226,20 @@ Featured Image, Figurë e Zgjedhur, Image mise en avant, Uitgelichte afbeelding,
226
 
227
  == Changelog ==
228
 
 
 
 
229
  = 3.8.2 =
230
  * Fix: conflict with WP Super Cache plugin (cache not working); fix: Lazy Load (conflict with themes that use LazySizes library).
231
 
232
  = 3.8.1 =
233
  * New: FIFU Cloud; enhancement: Lazy Load (ignores top images for a better performance); enhancement: better integration with Octolook Scrapes plugin (Schedule Metadata Generation is not necessary anymore); fix: CDN + Optimized Thumbnails (conflict with SVG images); fix: WooCommerce (Product Gallery metabox not displayed when there was an external Product Image).
234
 
235
- = 3.8.0 =
236
- * Fix: the regular featured image metabox will be closed and not longer removed when the post has an external featured image.
237
-
238
  = others =
239
  * [more](https://fifu.app/changelog)
240
 
241
 
242
  == Upgrade Notice ==
243
 
244
- = 3.8.2 =
245
- * Fix: conflict with WP Super Cache plugin (cache not working); fix: Lazy Load (conflict with themes that use LazySizes library).
3
  Donate link: https://donorbox.org/fifu
4
  Tags: featured, image, url, video, woocommerce
5
  Requires at least: 5.3
6
+ Tested up to: 5.9
7
+ Stable tag: 3.8.3
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
 
226
 
227
  == Changelog ==
228
 
229
+ = 3.8.3 =
230
+ * Fix: CDN + Optimized thumbnails (not working for images loaded via ajax); fix: Hide Featured Media (no images in related posts); fix: conflict with BuddyBoss App (lightbox not opening); fix: conflict with Wolmart theme (fatal error).
231
+
232
  = 3.8.2 =
233
  * Fix: conflict with WP Super Cache plugin (cache not working); fix: Lazy Load (conflict with themes that use LazySizes library).
234
 
235
  = 3.8.1 =
236
  * New: FIFU Cloud; enhancement: Lazy Load (ignores top images for a better performance); enhancement: better integration with Octolook Scrapes plugin (Schedule Metadata Generation is not necessary anymore); fix: CDN + Optimized Thumbnails (conflict with SVG images); fix: WooCommerce (Product Gallery metabox not displayed when there was an external Product Image).
237
 
 
 
 
238
  = others =
239
  * [more](https://fifu.app/changelog)
240
 
241
 
242
  == Upgrade Notice ==
243
 
244
+ = 3.8.3 =
245
+ * Fix: CDN + Optimized thumbnails (not working for images loaded via ajax); fix: Hide Featured Media (no images in related posts); fix: conflict with BuddyBoss App (lightbox not opening); fix: conflict with Wolmart theme (fatal error).