|
|
@@ -32,6 +32,10 @@ class Studiou_WC_FPP_Product {
|
|
|
$enabled = get_post_meta($product_id, '_studiou_fpp_enabled', true);
|
|
|
$media_category = get_post_meta($product_id, '_studiou_fpp_media_category', true);
|
|
|
$max_file_size = get_post_meta($product_id, '_studiou_fpp_max_file_size', true);
|
|
|
+ $min_width = get_post_meta($product_id, '_studiou_fpp_min_width', true);
|
|
|
+ $min_height = get_post_meta($product_id, '_studiou_fpp_min_height', true);
|
|
|
+ $max_width = get_post_meta($product_id, '_studiou_fpp_max_width', true);
|
|
|
+ $max_height = get_post_meta($product_id, '_studiou_fpp_max_height', true);
|
|
|
|
|
|
if (empty($max_file_size)) {
|
|
|
$max_file_size = 50;
|
|
|
@@ -100,6 +104,27 @@ class Studiou_WC_FPP_Product {
|
|
|
?>
|
|
|
</div>
|
|
|
|
|
|
+ <div class="options_group">
|
|
|
+ <p class="form-field">
|
|
|
+ <label><?php esc_html_e('Min Image Resolution (px)', 'studiou-wc-free-photo-product'); ?></label>
|
|
|
+ <span class="wrap">
|
|
|
+ <input type="number" id="_studiou_fpp_min_width" name="_studiou_fpp_min_width" class="short" style="width:80px;" min="0" step="1" value="<?php echo esc_attr($min_width); ?>" placeholder="<?php esc_attr_e('Width', 'studiou-wc-free-photo-product'); ?>" />
|
|
|
+ ×
|
|
|
+ <input type="number" id="_studiou_fpp_min_height" name="_studiou_fpp_min_height" class="short" style="width:80px;" min="0" step="1" value="<?php echo esc_attr($min_height); ?>" placeholder="<?php esc_attr_e('Height', 'studiou-wc-free-photo-product'); ?>" />
|
|
|
+ </span>
|
|
|
+ <?php echo wc_help_tip(__('Minimum image resolution in pixels. Leave empty to skip. Width and height are interchangeable (portrait/landscape auto-detected).', 'studiou-wc-free-photo-product')); ?>
|
|
|
+ </p>
|
|
|
+ <p class="form-field">
|
|
|
+ <label><?php esc_html_e('Max Image Resolution (px)', 'studiou-wc-free-photo-product'); ?></label>
|
|
|
+ <span class="wrap">
|
|
|
+ <input type="number" id="_studiou_fpp_max_width" name="_studiou_fpp_max_width" class="short" style="width:80px;" min="0" step="1" value="<?php echo esc_attr($max_width); ?>" placeholder="<?php esc_attr_e('Width', 'studiou-wc-free-photo-product'); ?>" />
|
|
|
+ ×
|
|
|
+ <input type="number" id="_studiou_fpp_max_height" name="_studiou_fpp_max_height" class="short" style="width:80px;" min="0" step="1" value="<?php echo esc_attr($max_height); ?>" placeholder="<?php esc_attr_e('Height', 'studiou-wc-free-photo-product'); ?>" />
|
|
|
+ </span>
|
|
|
+ <?php echo wc_help_tip(__('Maximum image resolution in pixels. Leave empty to skip. Width and height are interchangeable (portrait/landscape auto-detected).', 'studiou-wc-free-photo-product')); ?>
|
|
|
+ </p>
|
|
|
+ </div>
|
|
|
+
|
|
|
<div class="options_group">
|
|
|
<p class="form-field">
|
|
|
<label><?php esc_html_e('Shortcode', 'studiou-wc-free-photo-product'); ?></label>
|
|
|
@@ -125,6 +150,13 @@ class Studiou_WC_FPP_Product {
|
|
|
if ($max_size > 500) $max_size = 500;
|
|
|
update_post_meta($product_id, '_studiou_fpp_max_file_size', $max_size);
|
|
|
}
|
|
|
+
|
|
|
+ // Resolution limits (0 or empty = no limit)
|
|
|
+ $res_fields = array('_studiou_fpp_min_width', '_studiou_fpp_min_height', '_studiou_fpp_max_width', '_studiou_fpp_max_height');
|
|
|
+ foreach ($res_fields as $field) {
|
|
|
+ $val = isset($_POST[$field]) ? absint($_POST[$field]) : 0;
|
|
|
+ update_post_meta($product_id, $field, $val ?: '');
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
public function ajax_add_media_category() {
|
|
|
@@ -165,4 +197,17 @@ class Studiou_WC_FPP_Product {
|
|
|
public static function get_product_media_category($product_id) {
|
|
|
return (int) get_post_meta($product_id, '_studiou_fpp_media_category', true);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * Get resolution limits for a product.
|
|
|
+ * Returns array with min_width, min_height, max_width, max_height (0 = no limit).
|
|
|
+ */
|
|
|
+ public static function get_product_resolution_limits($product_id) {
|
|
|
+ return array(
|
|
|
+ 'min_width' => (int) get_post_meta($product_id, '_studiou_fpp_min_width', true),
|
|
|
+ 'min_height' => (int) get_post_meta($product_id, '_studiou_fpp_min_height', true),
|
|
|
+ 'max_width' => (int) get_post_meta($product_id, '_studiou_fpp_max_width', true),
|
|
|
+ 'max_height' => (int) get_post_meta($product_id, '_studiou_fpp_max_height', true),
|
|
|
+ );
|
|
|
+ }
|
|
|
}
|