wp_get_image_editor()创建一个图片编辑器,实现旋转/改变大小/另存

目录

描述

This function is the main function that you use when you want to get a reference to an image, to edit a local image on the server. It returns a WP_Image_Editor instance and loads a file into it. With that you can manipulate an image by calling methods on it. For more information see: WP_Image_Editor.

wp_get_image_editor() 描述

用法

<?php wp_get_image_editor$path$args ); ?> 

wp_get_image_editor() 用法

参数

$path

(string) (必填) Path to file to load. The path parameter should be a local file (such as /var/www/wordpress/some/directory/image). In some cases using a url as the parameter will work, but depending on the server setup and firewalls, fetching the url of the image may or may not work!!

默认值: None

$args

(array) (可选) Additional data. Accepts mime_type, methods

默认值: Empty

wp_get_image_editor() 参数

示例

wp_get_image_editor() 示例

历史

  • 添加于 版本: 3.5.0

wp_get_image_editor() 历史

源文件

wp_get_image_editor() 函数的代码位于 wp-includes/media.php

wp_get_image_editor() 源文件