设置elprogress最小尺寸

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了设置elprogress最小尺寸相关的知识,希望对你有一定的参考价值。

参考技术A 20。设置elprogress最小尺寸是20,在el-progress组件中添加stroke-width属性,设置值为20,用于设置圆形进度条的宽为20px大小。el-progress前端静态加载条,通过定时器产生随机1-10数字,需要动态的可以通过接口返回时间数据修改代码。

php 根据当前注册的图像尺寸(Wordpress),根据最小高度自动限制最小上传尺寸

<?
// Limit upload size
function themeprefix_limit_upload_size($file) {

  $img = getimagesize($file['tmp_name']);
  $minimum = themeprefix_get_minimum_width_height_of_all_sizes();
  $width = $img[0];
  $height = $img[1];

  if ($width < $minimum['width'] ) {
    
    return array('name' => $file['name'], 'error' => 'Image dimensions are too small. Minimum width is ' . $minimum['width'] . ' pixels. Uploaded image width is ' . $width . ' pixels');
  } elseif ($height <  $minimum['height']) {
    return array('name' => $file['name'], 'error' => 'Image dimensions are too small. Minimum height is ' . $minimum['height'] . ' pixels. Uploaded image height is ' . $height . ' pixels');
  } else {
    return $file; 
  }
}

add_filter('wp_handle_upload_prefilter','themeprefix_limit_upload_size');



// Get all image sizes along with width and height
function themeprefix_get_all_image_sizes() {
  global $_wp_additional_image_sizes;

  $default_image_sizes = get_intermediate_image_sizes();

  foreach ($default_image_sizes as $size) {
    $image_sizes[$size]['width'] = intval(get_option("{$size}_size_w"));
    $image_sizes[$size]['height'] = intval(get_option( "{$size}_size_h"));
    $image_sizes[ $size ]['crop'] = get_option( "{$size}_crop" ) ? get_option( "{$size}_crop" ) : false;
  }

  if ( isset($_wp_additional_image_sizes) && count($_wp_additional_image_sizes) ) {
    $image_sizes = array_merge($image_sizes, $_wp_additional_image_sizes);
  }

  return $image_sizes;
}



// Get minimum width and height from all the registered sizes
function themeprefix_get_minimum_width_height_of_all_sizes() {
  $all_image_sizes = hram_get_all_image_sizes();
  $all_widths = array();
  $all_heights = array();
  foreach ($all_image_sizes as $size_name => $dimensions) {
    if ($dimensions['width'] != '0') {
      $all_widths[] = $dimensions['width'];    
    }
    if ($dimensions['height'] != '0') {
      $all_heights[] = $dimensions['height'];    
    }
  }
  $min_dimensions = array('width' => min($all_widths), 'height' => min($all_heights));
  return $min_dimensions;
}

以上是关于设置elprogress最小尺寸的主要内容,如果未能解决你的问题,请参考以下文章

如何将 QStackedWidget 大小设置为子小部件的最小尺寸?

php 通过媒体管理器设置图像上传的最小和最大尺寸

如何设置 img 的最小和最大尺寸并保持纵横比? [复制]

移动端页面尺寸之一倍图二倍图三倍图

渐进式jpeg(progressive jpeg)图片及其相关

python tkinter 设置窗口大小不可缩放