Featured Image From URL - Version 2.9.1

Version Description

  • Improvement: URL from Post Content feature can work with the nth image now; Improvement: Hide Featured Media feature can work with Custom Post Types now; Bug fix: image width was being limited to 1000px; Bug fix: conflict with internal images.
Download this release

Release Info

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

Code changes from version 2.9.0 to 2.9.1

admin/html/js/menu.js CHANGED
@@ -31,6 +31,7 @@ jQuery(function () {
31
  jQuery("#tabs-top").tabs();
32
  jQuery("#fifu_input_spinner_cron_metadata").spinner({min: 1, step: 1});
33
  jQuery("#fifu_input_spinner_db").spinner({min: 100, step: 100});
 
34
  jQuery("#fifu_input_spinner_image").spinner({min: 0});
35
  jQuery("#fifu_input_spinner_video").spinner({min: 0});
36
  jQuery("#fifu_input_spinner_slider").spinner({min: 0});
31
  jQuery("#tabs-top").tabs();
32
  jQuery("#fifu_input_spinner_cron_metadata").spinner({min: 1, step: 1});
33
  jQuery("#fifu_input_spinner_db").spinner({min: 100, step: 100});
34
+ jQuery("#fifu_input_spinner_nth").spinner({min: 1});
35
  jQuery("#fifu_input_spinner_image").spinner({min: 0});
36
  jQuery("#fifu_input_spinner_video").spinner({min: 0});
37
  jQuery("#fifu_input_spinner_slider").spinner({min: 0});
admin/html/menu.html CHANGED
@@ -279,13 +279,32 @@
279
 
280
  <h2>Configuration</h2>
281
  <div class="greybox">
282
- This option makes FIFU read the HTML of your internal post/page/product content and use the first image/video URL found as "featured image". It will happen when you click on Publish/Update button.<br/><br/>
283
  <b>Important</b>: the images need to be in an "img" HTML tag and videos (Premium feature) in an "iframe" tag. So contents provided by [shortcodes] can't be read.
284
  </div>
285
 
286
  <br>
287
 
288
  <table style="text-align:left">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
289
  <tr>
290
  <th>
291
  <form
@@ -309,7 +328,7 @@
309
  </form>
310
  </th>
311
  <th>
312
- use the first image/video as featured image
313
  </th>
314
  </tr>
315
  <tr>
@@ -335,7 +354,7 @@
335
  </form>
336
  </th>
337
  <th>
338
- hide the first image/video from content
339
  </th>
340
  </tr>
341
  <tr>
@@ -398,7 +417,7 @@
398
  <div class="greybox" id="grad2">
399
  <b>Premium feature</b><br><br>
400
  Enable that to update all your posts/pages/products applying the configuration above.
401
- Very useful if you have hundreds of them and want to set the first image as featured image for all.
402
  It can take some minutes and can't be undone, so make a backup.
403
  To repeat the process enable the toggle again.
404
  <br><br>
@@ -768,6 +787,33 @@
768
  <th>
769
  on post
770
  </th>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
771
  </tr>
772
  </table>
773
  </div>
@@ -2656,7 +2702,7 @@
2656
  Just send me an email. If you are available to discuss the details and the plugin is free and has more than 100,000 active installs, I should provide an integration very soon.
2657
  </td>
2658
  <td>
2659
- You can set external featured images using custom fields. The main one is <b>fifu_image_url</b>. However the REST API is only supported by FIFU Premium. For nonstandard automation, just enable Schedule Metadata Generation, at Admin Area tab (no additional code required).
2660
  </td>
2661
  </tr>
2662
  </table>
@@ -2728,7 +2774,7 @@
2728
  </div>
2729
  <div class="greybox" style="position: relative; top: -10px">
2730
  Adding external "Product Image" and "Product Gallery" via SQL:<br>
2731
- 1) enable "FIFU Settings > Admin Area > Schedule Metadata Generation";<br>
2732
  2) run the SQL. Example: "insert into wp_postmeta (post_id, meta_key, meta_value) values (12345, 'fifu_list_url', 'URL1|URL2|URL3|URL4')"<br>
2733
  * the first URL is for the featured image and the others for the gallery<br>
2734
  </div>
@@ -2779,7 +2825,7 @@
2779
  </table>
2780
  <div class="greybox" style="position: relative; top: -10px">
2781
  Duplicating post and external featured image:<br>
2782
- 1) enable "FIFU Settings > Admin Area > Schedule Metadata Generation";<br>
2783
  2) access "Multisite Post Duplicator Settings";<br>
2784
  3) disable "Copy featured image when duplicating";<br>
2785
  4) disable "Copy post content images to destination media library";<br>
@@ -2859,7 +2905,7 @@
2859
  </table>
2860
  <div class="greybox" style="position: relative; top: -10px">
2861
  Solving "Uncaught ReferenceError: jQuery is not defined"<br>
2862
- 1) enable "FIFU settings > Admin Area > jQuery".<br>
2863
  </div>
2864
  </div>
2865
  <div class="box">
@@ -2918,7 +2964,7 @@
2918
  Copying the external featured image to the translation:<br>
2919
  1) access "WPML > Settings > Custom Fields Translation";<br>
2920
  2) search for "fifu_image_url", choose "Copy" and save;<br>
2921
- 3) if you use FIFU Premium, enable "Admin Area > Schedule Metadata Generation". That's all;<br>
2922
  4) but if you use the free version, after the translation post is created, access the post editor and click on "Update" button.<br>
2923
  </div>
2924
  </div>
279
 
280
  <h2>Configuration</h2>
281
  <div class="greybox">
282
+ This option makes FIFU read the HTML of your internal post/page/product content and use the 1st (or nth) image/video URL found as "featured image". It will happen when you click on Publish/Update button.<br/><br/>
283
  <b>Important</b>: the images need to be in an "img" HTML tag and videos (Premium feature) in an "iframe" tag. So contents provided by [shortcodes] can't be read.
284
  </div>
285
 
286
  <br>
287
 
288
  <table style="text-align:left">
289
+ <tr>
290
+ <th>
291
+ <form
292
+ id="fifu_form_spinner_nth"
293
+ action="javascript:void(0)"
294
+ method="post">
295
+ <input id="fifu_input_spinner_nth"
296
+ name="fifu_input_spinner_nth"
297
+ value="<?php echo $nth_image; ?>"
298
+ size="3"
299
+ style="width:40px">
300
+ <br>
301
+ <input type="submit" value="OK" style="width:72px">
302
+ </form>
303
+ </th>
304
+ <th>
305
+ image/video position
306
+ </th>
307
+ </tr>
308
  <tr>
309
  <th>
310
  <form
328
  </form>
329
  </th>
330
  <th>
331
+ use the 1st (or nth) image/video as featured image
332
  </th>
333
  </tr>
334
  <tr>
354
  </form>
355
  </th>
356
  <th>
357
+ hide the 1st (or nth) image/video from content
358
  </th>
359
  </tr>
360
  <tr>
417
  <div class="greybox" id="grad2">
418
  <b>Premium feature</b><br><br>
419
  Enable that to update all your posts/pages/products applying the configuration above.
420
+ Very useful if you have hundreds of them and want to set the 1st (or nth) image/video as featured image for all.
421
  It can take some minutes and can't be undone, so make a backup.
422
  To repeat the process enable the toggle again.
423
  <br><br>
787
  <th>
788
  on post
789
  </th>
790
+ </tr>
791
+ <tr>
792
+ <th>
793
+ <form
794
+ id="fifu_form_hide_cpt"
795
+ action="javascript:void(0)"
796
+ method="post">
797
+ <input
798
+ type="submit"
799
+ href="javascript:void(0)"
800
+ id="fifu_toggle_hide_cpt"
801
+ onclick="invert('hide_cpt')"
802
+ name="fifu_toggle_hide_cpt"
803
+ class="<?php echo $enable_hide_cpt; ?>"
804
+ value=""
805
+ style="display:block;border:none">
806
+
807
+ <input
808
+ type="hidden"
809
+ id="fifu_input_hide_cpt"
810
+ name="fifu_input_hide_cpt"
811
+ value="" >
812
+ </form>
813
+ </th>
814
+ <th>
815
+ on custom post type
816
+ </th>
817
  </tr>
818
  </table>
819
  </div>
2702
  Just send me an email. If you are available to discuss the details and the plugin is free and has more than 100,000 active installs, I should provide an integration very soon.
2703
  </td>
2704
  <td>
2705
+ You can set external featured images using custom fields. The main one is <b>fifu_image_url</b>. However the REST API is only supported by FIFU Premium. For nonstandard automation, just enable Schedule Metadata Generation, at Admin tab (no additional code required).
2706
  </td>
2707
  </tr>
2708
  </table>
2774
  </div>
2775
  <div class="greybox" style="position: relative; top: -10px">
2776
  Adding external "Product Image" and "Product Gallery" via SQL:<br>
2777
+ 1) enable "FIFU Settings > Admin > Schedule Metadata Generation";<br>
2778
  2) run the SQL. Example: "insert into wp_postmeta (post_id, meta_key, meta_value) values (12345, 'fifu_list_url', 'URL1|URL2|URL3|URL4')"<br>
2779
  * the first URL is for the featured image and the others for the gallery<br>
2780
  </div>
2825
  </table>
2826
  <div class="greybox" style="position: relative; top: -10px">
2827
  Duplicating post and external featured image:<br>
2828
+ 1) enable "FIFU Settings > Admin > Schedule Metadata Generation";<br>
2829
  2) access "Multisite Post Duplicator Settings";<br>
2830
  3) disable "Copy featured image when duplicating";<br>
2831
  4) disable "Copy post content images to destination media library";<br>
2905
  </table>
2906
  <div class="greybox" style="position: relative; top: -10px">
2907
  Solving "Uncaught ReferenceError: jQuery is not defined"<br>
2908
+ 1) enable "FIFU settings > Admin > jQuery".<br>
2909
  </div>
2910
  </div>
2911
  <div class="box">
2964
  Copying the external featured image to the translation:<br>
2965
  1) access "WPML > Settings > Custom Fields Translation";<br>
2966
  2) search for "fifu_image_url", choose "Copy" and save;<br>
2967
+ 3) if you use FIFU Premium, enable "Admin > Schedule Metadata Generation". That's all;<br>
2968
  4) but if you use the free version, after the translation post is created, access the post editor and click on "Update" button.<br>
2969
  </div>
2970
  </div>
admin/html/support-data.html CHANGED
@@ -35,6 +35,7 @@ fifu_enable_default_url:<?php echo $enable_default_url ?>;
35
  fifu_fake:<?php echo $enable_fake ?>;
36
  fifu_get_first:<?php echo $enable_get_first ?>;
37
  fifu_grid_category:<?php echo $enable_grid_category ?>;
 
38
  fifu_hide_page:<?php echo $enable_hide_page ?>;
39
  fifu_hide_post:<?php echo $enable_hide_post ?>;
40
  fifu_image_height_arch:<?php echo $max_image_height_arch ?>;
@@ -65,6 +66,7 @@ fifu_save_dimensions_all:<?php echo $enable_save_dimensions_all ?>;
65
  fifu_save_dimensions_redirect:<?php echo $enable_save_dimensions_redirect ?>;
66
  fifu_social:<?php echo $enable_social ?>;
67
  fifu_spinner_db:<?php echo $max_db ?>;
 
68
  fifu_wc_lbox:<?php echo $enable_wc_lbox ?>;
69
  fifu_wc_zoom:<?php echo $enable_wc_zoom ?>;
70
  REST Routes:
35
  fifu_fake:<?php echo $enable_fake ?>;
36
  fifu_get_first:<?php echo $enable_get_first ?>;
37
  fifu_grid_category:<?php echo $enable_grid_category ?>;
38
+ fifu_hide_cpt:<?php echo $enable_hide_cpt ?>;
39
  fifu_hide_page:<?php echo $enable_hide_page ?>;
40
  fifu_hide_post:<?php echo $enable_hide_post ?>;
41
  fifu_image_height_arch:<?php echo $max_image_height_arch ?>;
66
  fifu_save_dimensions_redirect:<?php echo $enable_save_dimensions_redirect ?>;
67
  fifu_social:<?php echo $enable_social ?>;
68
  fifu_spinner_db:<?php echo $max_db ?>;
69
+ fifu_spinner_nth:<?php echo $nth_image ?>;
70
  fifu_wc_lbox:<?php echo $enable_wc_lbox ?>;
71
  fifu_wc_zoom:<?php echo $enable_wc_zoom ?>;
72
  REST Routes:
admin/menu.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
 
3
- define('FIFU_SETTINGS', serialize(array('fifu_social', 'fifu_original', 'fifu_lazy', 'fifu_jquery', 'fifu_media_library', 'fifu_content', 'fifu_content_page', 'fifu_enable_default_url', 'fifu_spinner_db', 'fifu_fake', 'fifu_css', 'fifu_default_url', 'fifu_wc_lbox', 'fifu_wc_zoom', 'fifu_hide_page', 'fifu_hide_post', 'fifu_class', 'fifu_get_first', 'fifu_pop_first', 'fifu_ovw_first', 'fifu_query_strings', 'fifu_column_height', 'fifu_grid_category', 'fifu_auto_alt', 'fifu_dynamic_alt', 'fifu_data_clean', 'fifu_image_height_shop', 'fifu_image_width_shop', 'fifu_image_height_prod', 'fifu_image_width_prod', 'fifu_image_height_cart', 'fifu_image_width_cart', 'fifu_image_height_ctgr', 'fifu_image_width_ctgr', 'fifu_image_height_arch', 'fifu_image_width_arch', 'fifu_image_height_home', 'fifu_image_width_home', 'fifu_image_height_page', 'fifu_image_width_page', 'fifu_image_height_post', 'fifu_image_width_post', 'fifu_save_dimensions', 'fifu_save_dimensions_redirect', 'fifu_save_dimensions_all', 'fifu_clean_dimensions_all')));
4
 
5
  add_action('admin_menu', 'fifu_insert_menu');
6
 
@@ -46,10 +46,12 @@ function fifu_support_data() {
46
  $default_url = get_option('fifu_default_url');
47
  $enable_default_url = get_option('fifu_enable_default_url');
48
  $max_db = get_option('fifu_spinner_db');
 
49
  $enable_wc_lbox = get_option('fifu_wc_lbox');
50
  $enable_wc_zoom = get_option('fifu_wc_zoom');
51
  $enable_hide_page = get_option('fifu_hide_page');
52
  $enable_hide_post = get_option('fifu_hide_post');
 
53
  $enable_class = get_option('fifu_class');
54
  $enable_get_first = get_option('fifu_get_first');
55
  $enable_pop_first = get_option('fifu_pop_first');
@@ -110,10 +112,12 @@ function fifu_get_menu_html() {
110
  $default_url = get_option('fifu_default_url');
111
  $enable_default_url = get_option('fifu_enable_default_url');
112
  $max_db = get_option('fifu_spinner_db');
 
113
  $enable_wc_lbox = get_option('fifu_wc_lbox');
114
  $enable_wc_zoom = get_option('fifu_wc_zoom');
115
  $enable_hide_page = get_option('fifu_hide_page');
116
  $enable_hide_post = get_option('fifu_hide_post');
 
117
  $enable_class = get_option('fifu_class');
118
  $enable_get_first = get_option('fifu_get_first');
119
  $enable_pop_first = get_option('fifu_pop_first');
@@ -168,6 +172,7 @@ function fifu_get_menu_settings() {
168
  function fifu_get_setting($type) {
169
  register_setting('settings-group', $type);
170
 
 
171
  $arrEmpty = array('fifu_default_url', 'fifu_css');
172
  $arrEmptyNo = array('fifu_image_height_shop', 'fifu_image_width_shop', 'fifu_image_height_prod', 'fifu_image_width_prod', 'fifu_image_height_cart', 'fifu_image_width_cart', 'fifu_image_height_ctgr', 'fifu_image_width_ctgr', 'fifu_image_height_arch', 'fifu_image_width_arch', 'fifu_image_height_home', 'fifu_image_width_home', 'fifu_image_height_page', 'fifu_image_width_page', 'fifu_image_height_post', 'fifu_image_width_post');
173
  $arr64 = array('fifu_column_height');
@@ -181,6 +186,8 @@ function fifu_get_setting($type) {
181
  update_option($type, '');
182
  else if (in_array($type, $arrEmptyNo))
183
  update_option($type, '', 'no');
 
 
184
  else if (in_array($type, $arr64))
185
  update_option($type, "64", 'no');
186
  else if (in_array($type, $arr100))
@@ -209,10 +216,12 @@ function fifu_update_menu_options() {
209
  fifu_update_option('fifu_input_default_url', 'fifu_default_url');
210
  fifu_update_option('fifu_input_enable_default_url', 'fifu_enable_default_url');
211
  fifu_update_option('fifu_input_spinner_db', 'fifu_spinner_db');
 
212
  fifu_update_option('fifu_input_wc_lbox', 'fifu_wc_lbox');
213
  fifu_update_option('fifu_input_wc_zoom', 'fifu_wc_zoom');
214
  fifu_update_option('fifu_input_hide_page', 'fifu_hide_page');
215
  fifu_update_option('fifu_input_hide_post', 'fifu_hide_post');
 
216
  fifu_update_option('fifu_input_class', 'fifu_class');
217
  fifu_update_option('fifu_input_get_first', 'fifu_get_first');
218
  fifu_update_option('fifu_input_pop_first', 'fifu_pop_first');
1
  <?php
2
 
3
+ define('FIFU_SETTINGS', serialize(array('fifu_social', 'fifu_original', 'fifu_lazy', 'fifu_jquery', 'fifu_media_library', 'fifu_content', 'fifu_content_page', 'fifu_enable_default_url', 'fifu_spinner_db', 'fifu_spinner_nth', 'fifu_fake', 'fifu_css', 'fifu_default_url', 'fifu_wc_lbox', 'fifu_wc_zoom', 'fifu_hide_page', 'fifu_hide_post', 'fifu_hide_cpt', 'fifu_class', 'fifu_get_first', 'fifu_pop_first', 'fifu_ovw_first', 'fifu_query_strings', 'fifu_column_height', 'fifu_grid_category', 'fifu_auto_alt', 'fifu_dynamic_alt', 'fifu_data_clean', 'fifu_image_height_shop', 'fifu_image_width_shop', 'fifu_image_height_prod', 'fifu_image_width_prod', 'fifu_image_height_cart', 'fifu_image_width_cart', 'fifu_image_height_ctgr', 'fifu_image_width_ctgr', 'fifu_image_height_arch', 'fifu_image_width_arch', 'fifu_image_height_home', 'fifu_image_width_home', 'fifu_image_height_page', 'fifu_image_width_page', 'fifu_image_height_post', 'fifu_image_width_post', 'fifu_save_dimensions', 'fifu_save_dimensions_redirect', 'fifu_save_dimensions_all', 'fifu_clean_dimensions_all')));
4
 
5
  add_action('admin_menu', 'fifu_insert_menu');
6
 
46
  $default_url = get_option('fifu_default_url');
47
  $enable_default_url = get_option('fifu_enable_default_url');
48
  $max_db = get_option('fifu_spinner_db');
49
+ $nth_image = get_option('fifu_spinner_nth');
50
  $enable_wc_lbox = get_option('fifu_wc_lbox');
51
  $enable_wc_zoom = get_option('fifu_wc_zoom');
52
  $enable_hide_page = get_option('fifu_hide_page');
53
  $enable_hide_post = get_option('fifu_hide_post');
54
+ $enable_hide_cpt = get_option('fifu_hide_cpt');
55
  $enable_class = get_option('fifu_class');
56
  $enable_get_first = get_option('fifu_get_first');
57
  $enable_pop_first = get_option('fifu_pop_first');
112
  $default_url = get_option('fifu_default_url');
113
  $enable_default_url = get_option('fifu_enable_default_url');
114
  $max_db = get_option('fifu_spinner_db');
115
+ $nth_image = get_option('fifu_spinner_nth');
116
  $enable_wc_lbox = get_option('fifu_wc_lbox');
117
  $enable_wc_zoom = get_option('fifu_wc_zoom');
118
  $enable_hide_page = get_option('fifu_hide_page');
119
  $enable_hide_post = get_option('fifu_hide_post');
120
+ $enable_hide_cpt = get_option('fifu_hide_cpt');
121
  $enable_class = get_option('fifu_class');
122
  $enable_get_first = get_option('fifu_get_first');
123
  $enable_pop_first = get_option('fifu_pop_first');
172
  function fifu_get_setting($type) {
173
  register_setting('settings-group', $type);
174
 
175
+ $arr1 = array('fifu_spinner_nth');
176
  $arrEmpty = array('fifu_default_url', 'fifu_css');
177
  $arrEmptyNo = array('fifu_image_height_shop', 'fifu_image_width_shop', 'fifu_image_height_prod', 'fifu_image_width_prod', 'fifu_image_height_cart', 'fifu_image_width_cart', 'fifu_image_height_ctgr', 'fifu_image_width_ctgr', 'fifu_image_height_arch', 'fifu_image_width_arch', 'fifu_image_height_home', 'fifu_image_width_home', 'fifu_image_height_page', 'fifu_image_width_page', 'fifu_image_height_post', 'fifu_image_width_post');
178
  $arr64 = array('fifu_column_height');
186
  update_option($type, '');
187
  else if (in_array($type, $arrEmptyNo))
188
  update_option($type, '', 'no');
189
+ else if (in_array($type, $arr1))
190
+ update_option($type, 1);
191
  else if (in_array($type, $arr64))
192
  update_option($type, "64", 'no');
193
  else if (in_array($type, $arr100))
216
  fifu_update_option('fifu_input_default_url', 'fifu_default_url');
217
  fifu_update_option('fifu_input_enable_default_url', 'fifu_enable_default_url');
218
  fifu_update_option('fifu_input_spinner_db', 'fifu_spinner_db');
219
+ fifu_update_option('fifu_input_spinner_nth', 'fifu_spinner_nth');
220
  fifu_update_option('fifu_input_wc_lbox', 'fifu_wc_lbox');
221
  fifu_update_option('fifu_input_wc_zoom', 'fifu_wc_zoom');
222
  fifu_update_option('fifu_input_hide_page', 'fifu_hide_page');
223
  fifu_update_option('fifu_input_hide_post', 'fifu_hide_post');
224
+ fifu_update_option('fifu_input_hide_cpt', 'fifu_hide_cpt');
225
  fifu_update_option('fifu_input_class', 'fifu_class');
226
  fifu_update_option('fifu_input_get_first', 'fifu_get_first');
227
  fifu_update_option('fifu_input_pop_first', 'fifu_pop_first');
featured-image-from-url.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin Name: Featured Image from URL
5
  * Plugin URI: https://fifu.app/
6
  * Description: Use an external image as Featured Image of your post/page/custom post type (WooCommerce). Includes Auto Set (External Post), Product Gallery, Social Tags and more.
7
- * Version: 2.9.0
8
  * Author: Marcel Jacques Machado
9
  * Author URI: https://www.linkedin.com/in/marceljm/
10
  */
4
  * Plugin Name: Featured Image from URL
5
  * Plugin URI: https://fifu.app/
6
  * Description: Use an external image as Featured Image of your post/page/custom post type (WooCommerce). Includes Auto Set (External Post), Product Gallery, Social Tags and more.
7
+ * Version: 2.9.1
8
  * Author: Marcel Jacques Machado
9
  * Author URI: https://www.linkedin.com/in/marceljm/
10
  */
includes/attachment.php CHANGED
@@ -50,7 +50,7 @@ add_filter('posts_where', function ( $where, \WP_Query $q ) {
50
  add_filter('wp_get_attachment_image_src', 'fifu_replace_attachment_image_src', 10, 3);
51
 
52
  function fifu_replace_attachment_image_src($image, $att_id, $size) {
53
- if (!$image || fifu_is_internal_image($image))
54
  return $image;
55
 
56
  if (!$att_id)
@@ -79,10 +79,6 @@ function fifu_replace_attachment_image_src($image, $att_id, $size) {
79
  );
80
  }
81
 
82
- function fifu_is_internal_image($image) {
83
- return $image && $image[1] > 1 && $image[2] > 1;
84
- }
85
-
86
  function fifu_get_internal_image_path() {
87
  return explode("//", get_home_url())[1] . "/wp-content/uploads/";
88
  }
@@ -120,7 +116,7 @@ function fifu_get_width_height($dimension) {
120
  $height = fifu_maximum('height');
121
 
122
  // a value is required, otherwise the zoom doesn't work
123
- if (!$width)
124
  $width = 1000;
125
  }
126
  return array('width' => $width, 'height' => $height);
50
  add_filter('wp_get_attachment_image_src', 'fifu_replace_attachment_image_src', 10, 3);
51
 
52
  function fifu_replace_attachment_image_src($image, $att_id, $size) {
53
+ if (!$image || fifu_has_internal_image_path($image[0]))
54
  return $image;
55
 
56
  if (!$att_id)
79
  );
80
  }
81
 
 
 
 
 
82
  function fifu_get_internal_image_path() {
83
  return explode("//", get_home_url())[1] . "/wp-content/uploads/";
84
  }
116
  $height = fifu_maximum('height');
117
 
118
  // a value is required, otherwise the zoom doesn't work
119
+ if (!$width && is_singular('product'))
120
  $width = 1000;
121
  }
122
  return array('width' => $width, 'height' => $height);
includes/external-post.php CHANGED
@@ -41,7 +41,7 @@ function fifu_save_properties_ext($post_id) {
41
  function fifu_first_img_in_content($content) {
42
  $matches = array();
43
  preg_match_all('/<img[^>]*>/', $content, $matches);
44
- return $matches && $matches[0] ? $matches[0][0] : null;
45
  }
46
 
47
  function fifu_show_all_images($content) {
@@ -72,9 +72,12 @@ function fifu_first_url_in_content($post_id) {
72
  if (!$matches[0])
73
  return;
74
 
 
 
75
  $tag = null;
76
  foreach ($matches[0] as $tag) {
77
- if ($tag && strpos($tag, 'data:image/jpeg') !== false)
 
78
  continue;
79
  break;
80
  }
41
  function fifu_first_img_in_content($content) {
42
  $matches = array();
43
  preg_match_all('/<img[^>]*>/', $content, $matches);
44
+ return $matches && $matches[0] ? $matches[0][get_option('fifu_spinner_nth') - 1] : null;
45
  }
46
 
47
  function fifu_show_all_images($content) {
72
  if (!$matches[0])
73
  return;
74
 
75
+ $i = 0;
76
+ $nth = get_option('fifu_spinner_nth');
77
  $tag = null;
78
  foreach ($matches[0] as $tag) {
79
+ $i++;
80
+ if (($tag && strpos($tag, 'data:image/jpeg') !== false) || ($i != $nth))
81
  continue;
82
  break;
83
  }
includes/thumbnail.php CHANGED
@@ -116,7 +116,11 @@ function fifu_add_to_content($content) {
116
  }
117
 
118
  function fifu_should_hide() {
119
- return ((is_singular('post') && fifu_is_on('fifu_hide_post')) || (is_singular('page') && fifu_is_on('fifu_hide_page')));
 
 
 
 
120
  }
121
 
122
  function fifu_main_image_url($post_id) {
116
  }
117
 
118
  function fifu_should_hide() {
119
+ return ((is_singular('post') && fifu_is_on('fifu_hide_post')) || (is_singular('page') && fifu_is_on('fifu_hide_page')) || (is_singular(get_post_type(get_the_ID())) && fifu_is_cpt() && fifu_is_on('fifu_hide_cpt')));
120
+ }
121
+
122
+ function fifu_is_cpt() {
123
+ return in_array(get_post_type(get_the_ID()), array_diff(fifu_get_post_types(), array('post', 'page')));
124
  }
125
 
126
  function fifu_main_image_url($post_id) {
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://donorbox.org/fifu
4
  Tags: featured image, external featured image, featured image from url, url featured image, featured, image, external, url, flickr, s3, picasa, woocommerce, product image, product gallery, product, gallery, column, list, page, post, all, content, custom, type, custom post type, category, video, external video, youtube, vimeo, featured video, hover, effects, hover effects, sirv, wp all import, css, style, slider, thumbnail, social, network, auto, publish, hide, first image, content, lightbox, size, grid, auto post thumbnail, link, uri, affiliate, wp, rest, api, wp rest api, lazy, load, google, drive, instagram, validation, jetpack, visual composer, play, pause, crop, resize, zoom, enable, disable, default, automatic, auto set, cloudinary, schedule, event, cron, seo, variable, tumblr, variation, product variation, shortcode, facebook, instagram, imgur, 9gag, wcfm, add-on, scraper
5
  Requires at least: 4.0
6
  Tested up to: 5.4
7
- Stable tag: 2.9.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -16,7 +16,7 @@ Features:
16
 
17
  * Featured Image from URL plugin allows you to use an external image as Featured Image of your post, page and Custom Post Type, such as WooCommerce Product;
18
 
19
- * perfect for external posts, the plugin is able to use the first image/video as Featured Image;
20
 
21
  * when you access the table of posts/pages/products/categories in admin menu, the Featured Images are shown in a new column;
22
 
@@ -42,29 +42,28 @@ Features:
42
 
43
  * allows to schedule an cron event to set all first images as featured images. So it can run hourly, daily etc. (**premium feature**);
44
 
45
- * all features created for external images are available for external videos from YouTube, Vimeo, Cloudinary and Tumblr. For YouTube videos, it's possible to set player parameters. And you can define the video size for each screen type (**premium feature**);
46
 
47
  * you can use a slider of images as "featured image" (**premium feature**);
48
 
49
- * you can use an external video thumbnail or an external video (from YouTube, Vimeo, Cloudinary or Tumblr) as "featured image" (**premium feature**);
50
 
51
- * you can use any content provided by a shortcode as "featured image" (**premium BETA feature**);
52
 
53
  * auto set product category images, with each image being chosen among the external product images from that category (**premium feature**);
54
 
55
  * it's also possible to use external images in the WooCommerce Product Gallery, Product Category and Variable Product (**premium feature**);
56
 
57
- * you can use external thumbnails from Flickr to make your site uppon to 94% faster (**premium feature**);
58
 
59
- * it's able to crop all the external featured images on home/shop to the same size (**premium feature**);
60
 
61
  * auto play/pause videos on mouse over/out (**premium feature**);
62
 
63
  * replace broken URLs by a default one (**premium feature**);
64
 
65
  **<a href="https://fifu.app/">Official Site</a>**
66
- **<a href="https://blog.featuredimagefromurl.com/">Live Preview (Blog)</a>**
67
- **<a href="https://shop.featuredimagefromurl.com/">Live Preview (Shop)</a>**
68
 
69
  == Installation ==
70
 
@@ -159,6 +158,9 @@ Features:
159
 
160
  == Changelog ==
161
 
 
 
 
162
  = 2.9.0 =
163
  * New: the plugin has its own Chrome Extension now; Bug fix: block-ui was not working after recent update.
164
 
@@ -699,6 +701,9 @@ was removed. To finish, a Premium version is now been presented.
699
 
700
  == Upgrade Notice ==
701
 
 
 
 
702
  = 2.9.0 =
703
  * New: the plugin has its own Chrome Extension now; Bug fix: block-ui was not working after recent update.
704
 
4
  Tags: featured image, external featured image, featured image from url, url featured image, featured, image, external, url, flickr, s3, picasa, woocommerce, product image, product gallery, product, gallery, column, list, page, post, all, content, custom, type, custom post type, category, video, external video, youtube, vimeo, featured video, hover, effects, hover effects, sirv, wp all import, css, style, slider, thumbnail, social, network, auto, publish, hide, first image, content, lightbox, size, grid, auto post thumbnail, link, uri, affiliate, wp, rest, api, wp rest api, lazy, load, google, drive, instagram, validation, jetpack, visual composer, play, pause, crop, resize, zoom, enable, disable, default, automatic, auto set, cloudinary, schedule, event, cron, seo, variable, tumblr, variation, product variation, shortcode, facebook, instagram, imgur, 9gag, wcfm, add-on, scraper
5
  Requires at least: 4.0
6
  Tested up to: 5.4
7
+ Stable tag: 2.9.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
16
 
17
  * Featured Image from URL plugin allows you to use an external image as Featured Image of your post, page and Custom Post Type, such as WooCommerce Product;
18
 
19
+ * perfect for external posts, the plugin is able to use the first (or nth) image/video as Featured Image;
20
 
21
  * when you access the table of posts/pages/products/categories in admin menu, the Featured Images are shown in a new column;
22
 
42
 
43
  * allows to schedule an cron event to set all first images as featured images. So it can run hourly, daily etc. (**premium feature**);
44
 
45
+ * all features created for external images are available for external videos from YouTube, Vimeo, Facebook, Instagram, Imgur, 9GAG, Cloudinary and Tumblr. For YouTube videos, it's possible to set player parameters. And you can define the video size for each screen type (**premium feature**);
46
 
47
  * you can use a slider of images as "featured image" (**premium feature**);
48
 
49
+ * you can use an external video thumbnail or an external video (from YouTube, Vimeo, Facebook, Instagram, Imgur, 9GAG, Cloudinary and Tumblr) as "featured image" (**premium feature**);
50
 
51
+ * you can use any content provided by a shortcode as "featured image" (**premium feature**);
52
 
53
  * auto set product category images, with each image being chosen among the external product images from that category (**premium feature**);
54
 
55
  * it's also possible to use external images in the WooCommerce Product Gallery, Product Category and Variable Product (**premium feature**);
56
 
57
+ * you can use external thumbnails from Flickr to make your site faster (**premium feature**);
58
 
59
+ * it's able to crop the external featured images to the same size (**premium feature**);
60
 
61
  * auto play/pause videos on mouse over/out (**premium feature**);
62
 
63
  * replace broken URLs by a default one (**premium feature**);
64
 
65
  **<a href="https://fifu.app/">Official Site</a>**
66
+ **<a href="https://chrome.google.com/webstore/detail/fifu-scraper/pccimcccbkdeeadhejdmnffmllpicola">Google Chrome Extension</a>**
 
67
 
68
  == Installation ==
69
 
158
 
159
  == Changelog ==
160
 
161
+ = 2.9.1 =
162
+ * Improvement: URL from Post Content feature can work with the nth image now; Improvement: Hide Featured Media feature can work with Custom Post Types now; Bug fix: image width was being limited to 1000px; Bug fix: conflict with internal images.
163
+
164
  = 2.9.0 =
165
  * New: the plugin has its own Chrome Extension now; Bug fix: block-ui was not working after recent update.
166
 
701
 
702
  == Upgrade Notice ==
703
 
704
+ = 2.9.1 =
705
+ * Improvement: URL from Post Content feature can work with the nth image now; Improvement: Hide Featured Media feature can work with Custom Post Types now; Bug fix: image width was being limited to 1000px; Bug fix: conflict with internal images.
706
+
707
  = 2.9.0 =
708
  * New: the plugin has its own Chrome Extension now; Bug fix: block-ui was not working after recent update.
709