当前位置: 首页>>代码示例>>PHP>>正文


PHP acf_get_image_sizes函数代码示例

本文整理汇总了PHP中acf_get_image_sizes函数的典型用法代码示例。如果您正苦于以下问题:PHP acf_get_image_sizes函数的具体用法?PHP acf_get_image_sizes怎么用?PHP acf_get_image_sizes使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了acf_get_image_sizes函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: render_field_settings

 function render_field_settings($field)
 {
     /*
      *  acf_render_field_setting
      *
      *  This function will create a setting for your field. Simply pass the $field parameter and an array of field settings.
      *  The array of settings does not require a `value` or `prefix`; These settings are found from the $field array.
      *
      *  More than one setting can be added by copy/paste the above code.
      *  Please note that you must also have a matching $defaults value for the field name (font_size)
      */
     // Render return value radio
     acf_render_field_setting($field, array('label' => __('Return Value', 'acf-focal_point'), 'instructions' => __('Specify the returned value on front end', 'acf-focal_point'), 'type' => 'radio', 'name' => 'save_format', 'layout' => 'horizontal', 'choices' => array('object' => __("Image Object", 'acf'), 'tag' => __("Image Tag", 'acf'))));
     // Render return size select
     acf_render_field_setting($field, array('label' => __('Image Size', 'acf-focal_point'), 'instructions' => __('Size of image when returning an image tag', 'acf-focal_point'), 'type' => 'select', 'name' => 'image_size', 'choices' => acf_get_image_sizes()));
     // Render preview size select
     acf_render_field_setting($field, array('label' => __('Preview Size', 'acf-focal_point'), 'instructions' => __('Image used to create a Focal Point. Should be around the same image ratio as Image Size', 'acf-focal_point'), 'type' => 'select', 'name' => 'preview_size', 'choices' => acf_get_image_sizes()));
 }
开发者ID:evu,项目名称:acf-focal_point,代码行数:18,代码来源:acf-focal_point-v5.php

示例2: render_field_settings

 function render_field_settings($field)
 {
     // return_format
     acf_render_field_setting($field, array('label' => __('Return Value', 'acf'), 'instructions' => __('Specify the returned value on front end', 'acf'), 'type' => 'radio', 'name' => 'return_format', 'layout' => 'horizontal', 'choices' => array('array' => __("Image Array", 'acf'), 'url' => __("Image URL", 'acf'), 'id' => __("Image ID", 'acf'))));
     // preview_size
     acf_render_field_setting($field, array('label' => __('Preview Size', 'acf'), 'instructions' => __('Shown when entering data', 'acf'), 'type' => 'select', 'name' => 'preview_size', 'choices' => acf_get_image_sizes()));
     // library
     acf_render_field_setting($field, array('label' => __('Library', 'acf'), 'instructions' => __('Limit the media library choice', 'acf'), 'type' => 'radio', 'name' => 'library', 'layout' => 'horizontal', 'choices' => array('all' => __('All', 'acf'), 'uploadedTo' => __('Uploaded to post', 'acf'))));
 }
开发者ID:adnandot,项目名称:intenseburn,代码行数:9,代码来源:image.php

示例3: render_field_settings

 function render_field_settings($field)
 {
     // clear numeric settings
     $clear = array('min', 'max', 'min_width', 'min_height', 'min_size', 'max_width', 'max_height', 'max_size');
     foreach ($clear as $k) {
         if (empty($field[$k])) {
             $field[$k] = '';
         }
     }
     // min
     acf_render_field_setting($field, array('label' => __('Minimum Selection', 'acf'), 'instructions' => '', 'type' => 'number', 'name' => 'min'));
     // max
     acf_render_field_setting($field, array('label' => __('Maximum Selection', 'acf'), 'instructions' => '', 'type' => 'number', 'name' => 'max'));
     // preview_size
     acf_render_field_setting($field, array('label' => __('Preview Size', 'acf'), 'instructions' => __('Shown when entering data', 'acf'), 'type' => 'select', 'name' => 'preview_size', 'choices' => acf_get_image_sizes()));
     // library
     acf_render_field_setting($field, array('label' => __('Library', 'acf'), 'instructions' => __('Limit the media library choice', 'acf'), 'type' => 'radio', 'name' => 'library', 'layout' => 'horizontal', 'choices' => array('all' => __('All', 'acf'), 'uploadedTo' => __('Uploaded to post', 'acf'))));
     // min
     acf_render_field_setting($field, array('label' => __('Minimum', 'acf'), 'instructions' => __('Restrict which images can be uploaded', 'acf'), 'type' => 'text', 'name' => 'min_width', 'prepend' => __('Width', 'acf'), 'append' => 'px'));
     acf_render_field_setting($field, array('label' => '', 'type' => 'text', 'name' => 'min_height', 'prepend' => __('Height', 'acf'), 'append' => 'px', 'wrapper' => array('data-append' => 'min_width')));
     acf_render_field_setting($field, array('label' => '', 'type' => 'text', 'name' => 'min_size', 'prepend' => __('File size', 'acf'), 'append' => 'MB', 'wrapper' => array('data-append' => 'min_width')));
     // max
     acf_render_field_setting($field, array('label' => __('Maximum', 'acf'), 'instructions' => __('Restrict which images can be uploaded', 'acf'), 'type' => 'text', 'name' => 'max_width', 'prepend' => __('Width', 'acf'), 'append' => 'px'));
     acf_render_field_setting($field, array('label' => '', 'type' => 'text', 'name' => 'max_height', 'prepend' => __('Height', 'acf'), 'append' => 'px', 'wrapper' => array('data-append' => 'max_width')));
     acf_render_field_setting($field, array('label' => '', 'type' => 'text', 'name' => 'max_size', 'prepend' => __('File size', 'acf'), 'append' => 'MB', 'wrapper' => array('data-append' => 'max_width')));
     // allowed type
     acf_render_field_setting($field, array('label' => __('Allowed file types', 'acf'), 'instructions' => __('Comma separated list. Leave blank for all types', 'acf'), 'type' => 'text', 'name' => 'mime_types'));
 }
开发者ID:TMBR,项目名称:johnjohn,代码行数:28,代码来源:gallery.php

示例4: render_field_settings

 function render_field_settings($field)
 {
     /*
      *  acf_render_field_setting
      *
      *  This function will create a setting for your field. Simply pass the $field parameter and an array of field settings.
      *  The array of settings does not require a `value` or `prefix`; These settings are found from the $field array.
      *
      *  More than one setting can be added by copy/paste the above code.
      *  Please note that you must also have a matching $defaults value for the field name (font_size)
      */
     // crop_type
     acf_render_field_setting($field, array('label' => __('Crop type', 'acf-image_crop'), 'instructions' => __('Select the type of crop the user should perform', 'acf-image_crop'), 'type' => 'select', 'name' => 'crop_type', 'layout' => 'horizontal', 'class' => 'crop-type-select', 'choices' => array('hard' => __('Hard crop', 'acf-image_crop'), 'min' => __('Minimal dimensions', 'acf-image_crop'))));
     // target_size
     $sizes = acf_get_image_sizes();
     // added
     $instructions = __('Select the target size for this field', 'acf-image_crop');
     if ($this->getOption('retina_mode')) {
         $instructions .= '<br><br><em><strong>' . __('Retina mode is enabled - user will be required to select an image twice this size', 'acf-image_crop') . '</strong></em>';
     }
     // added END
     $sizes['custom'] = __('Custom size', 'acf-image_crop');
     acf_render_field_setting($field, array('label' => __('Target size', 'acf-image_crop'), 'instructions' => $instructions, 'type' => 'select', 'name' => 'target_size', 'class' => 'target-size-select', 'choices' => $sizes));
     // width - conditional: target_size == 'custom'
     acf_render_field_setting($field, array('label' => __('Custom target width', 'acf-image_crop'), 'instructions' => __('Leave blank for no restriction (does not work with hard crop option)', 'acf-image_crop'), 'type' => 'number', 'name' => 'width', 'class' => 'custom-target-width custom-target-dimension', 'append' => 'px'));
     // height - conditional: target_size == 'custom'
     acf_render_field_setting($field, array('label' => __('Custom target height', 'acf-image_crop'), 'instructions' => __('Leave blank for no restriction (does not work with hard crop option)', 'acf-image_crop'), 'type' => 'number', 'name' => 'height', 'class' => 'custom-target-height custom-target-dimension', 'append' => 'px'));
     // preview_size
     acf_render_field_setting($field, array('label' => __('Preview Size', 'acf'), 'instructions' => __('Shown when entering data', 'acf'), 'type' => 'select', 'name' => 'preview_size', 'choices' => acf_get_image_sizes()));
     // force_crop
     acf_render_field_setting($field, array('label' => __('Force crop', 'acf-image_crop'), 'instructions' => __('Force the user to crop the image as soon at it is selected', 'acf-image_crop'), 'type' => 'radio', 'layout' => 'horizontal', 'name' => 'force_crop', 'choices' => array('yes' => __('Yes', 'acf'), 'no' => __('No', 'acf'))));
     // save_in_media_library
     acf_render_field_setting($field, array('label' => __('Save cropped image to media library', 'acf-image_crop'), 'instructions' => __('If the cropped image is not saved in the media library, "Image URL" is the only available return value.', 'acf-image_crop'), 'type' => 'radio', 'layout' => 'horizontal', 'name' => 'save_in_media_library', 'class' => 'save-in-media-library-select', 'choices' => array('yes' => __('Yes', 'acf'), 'no' => __('No', 'acf'))));
     // only show this setting if the global option for retina mode is not activated
     // retina mode
     if (!$this->getOption('retina_mode')) {
         acf_render_field_setting($field, array('label' => __('Retina/@2x mode ', 'acf-image_crop'), 'instructions' => __('Require and crop double the size set for this image. Enable this if you are using plugins like WP Retina 2x.', 'acf-image_crop'), 'type' => 'radio', 'layout' => 'horizontal', 'name' => 'retina_mode', 'choices' => array('yes' => __('Yes', 'acf'), 'no' => __('No', 'acf'))));
     }
     // return_format
     acf_render_field_setting($field, array('label' => __('Return Value', 'acf'), 'instructions' => __('Specify the returned value on front end', 'acf'), 'type' => 'radio', 'name' => 'save_format', 'layout' => 'horizontal', 'class' => 'return-value-select', 'choices' => array('object' => __("Image Array", 'acf'), 'url' => __("Image URL", 'acf'), 'id' => __("Image ID", 'acf'))));
     // library
     acf_render_field_setting($field, array('label' => __('Library', 'acf'), 'instructions' => __('Limit the media library choice', 'acf'), 'type' => 'radio', 'name' => 'library', 'layout' => 'horizontal', 'choices' => array('all' => __('All', 'acf'), 'uploadedTo' => __('Uploaded to post', 'acf'))));
 }
开发者ID:jenniwhite6,项目名称:My-Blog,代码行数:43,代码来源:acf-image-crop-v5.php

示例5: render_field_settings

 function render_field_settings($field)
 {
     // min / max
     $field['min'] = empty($field['min']) ? '' : $field['min'];
     $field['max'] = empty($field['max']) ? '' : $field['max'];
     // min
     acf_render_field_setting($field, array('label' => __('Minimum Selection', 'acf'), 'instructions' => '', 'type' => 'number', 'name' => 'min', 'placeholder' => '0'));
     // max
     acf_render_field_setting($field, array('label' => __('Maximum Selection', 'acf'), 'instructions' => '', 'type' => 'number', 'name' => 'max', 'placeholder' => '0'));
     // preview_size
     acf_render_field_setting($field, array('label' => __('Preview Size', 'acf'), 'instructions' => __('Shown when entering data', 'acf'), 'type' => 'select', 'name' => 'preview_size', 'choices' => acf_get_image_sizes()));
     // library
     acf_render_field_setting($field, array('label' => __('Library', 'acf'), 'instructions' => __('Limit the media library choice', 'acf'), 'type' => 'radio', 'name' => 'library', 'layout' => 'horizontal', 'choices' => array('all' => __('All', 'acf'), 'uploadedTo' => __('Uploaded to post', 'acf'))));
 }
开发者ID:adnandot,项目名称:intenseburn,代码行数:14,代码来源:gallery.php

示例6: render_field_settings

 function render_field_settings($field)
 {
     /*
      *  acf_render_field_setting
      *
      *  This function will create a setting for your field. Simply pass the $field parameter and an array of field settings.
      *  The array of settings does not require a `value` or `prefix`; These settings are found from the $field array.
      *
      *  More than one setting can be added by copy/paste the above code.
      *  Please note that you must also have a matching $defaults value for the field name (font_size)
      */
     // crop_type
     acf_render_field_setting($field, array('label' => __('Crop type', 'acf-image_crop'), 'instructions' => __('Select the type of crop the user should perform', 'acf-image_crop'), 'type' => 'select', 'name' => 'crop_type', 'layout' => 'horizontal', 'class' => 'crop-type-select', 'choices' => array('hard' => __('Hard crop', 'acf-image_crop'), 'min' => __('Minimal dimensions', 'acf-image_crop'))));
     // target_size
     $sizes = acf_get_image_sizes();
     $sizes['custom'] = __('Custom size', 'acf-image_crop');
     acf_render_field_setting($field, array('label' => __('Target size', 'acf-image_crop'), 'instructions' => __('Select the target size for this field', 'acf-image_crop'), 'type' => 'select', 'name' => 'target_size', 'class' => 'target-size-select', 'choices' => $sizes));
     // width - conditional: target_size == 'custom'
     acf_render_field_setting($field, array('label' => __('Custom target width', 'acf-image_crop'), 'instructions' => __('Leave blank for no restriction (does not work with hard crop option)', 'acf-image_crop'), 'type' => 'number', 'name' => 'width', 'class' => 'custom-target-width custom-target-dimension'));
     // height - conditional: target_size == 'custom'
     acf_render_field_setting($field, array('label' => __('Custom target height', 'acf-image_crop'), 'instructions' => __('Leave blank for no restriction (does not work with hard crop option)', 'acf-image_crop'), 'type' => 'number', 'name' => 'height', 'class' => 'custom-target-height custom-target-dimension'));
     // preview_size
     acf_render_field_setting($field, array('label' => __('Preview size', 'acf-image_crop'), 'instructions' => __('Select the preview size for this field', 'acf-image_crop'), 'type' => 'select', 'name' => 'preview_size', 'choices' => acf_get_image_sizes()));
     // force_crop
     acf_render_field_setting($field, array('label' => __('Force crop', 'acf-image_crop'), 'instructions' => __('Force the user to crop the image as soon at it is selected', 'acf-image_crop'), 'type' => 'radio', 'layout' => 'horizontal', 'name' => 'force_crop', 'choices' => array('yes' => 'Yes', 'no' => 'No')));
     // save_in_media_library
     acf_render_field_setting($field, array('label' => __('Save cropped image to media library', 'acf-image_crop'), 'instructions' => __('If the cropped image is not saved in the media library, "Image URL" is the only available return value.', 'acf-image_crop'), 'type' => 'radio', 'layout' => 'horizontal', 'name' => 'save_in_media_library', 'class' => 'save-in-media-library-select', 'choices' => array('yes' => 'Yes', 'no' => 'No')));
     // return_format
     acf_render_field_setting($field, array('label' => __('Return Value', 'acf-image_crop'), 'instructions' => __('Specify the returned value on front end', 'acf-image_crop'), 'type' => 'radio', 'name' => 'save_format', 'layout' => 'horizontal', 'class' => 'return-value-select', 'choices' => array('url' => __("Image URL", 'acf'), 'id' => __("Image ID", 'acf'), 'object' => __("Image Object", 'acf'))));
     // library
     acf_render_field_setting($field, array('label' => __('Library', 'acf'), 'instructions' => __('Limit the media library choice', 'acf'), 'type' => 'radio', 'name' => 'library', 'layout' => 'horizontal', 'choices' => array('all' => __('All', 'acf'), 'uploadedTo' => __('Uploaded to post', 'acf'))));
 }
开发者ID:polevaultweb,项目名称:ACF-Image-Crop,代码行数:32,代码来源:acf-image-crop-v5.php


注:本文中的acf_get_image_sizes函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。