使用卸载媒体时,图像裁剪无法正常工作

时间:2020-05-12 作者:Jeff W

我一直在使用blankslate样板文件和;我对它的表现很满意,只提供了一些小细节。这涉及到站点使用卸载媒体插件时的图像裁剪;已启用“从服务器删除文件”设置。我和OM的人谈过一点&;他们很有帮助,但最终如果他们的插件没有引起任何问题,他们就不会来解决我的主题问题,我理解这一点。

My question is how can I modify my code to delay sending the file to the S3 bucket until the customizer has had a chance to crop & place the image?

我的代码在下面(&M);我很感激你的建议!

    // Some picture
        $wp_customize->add_setting( \'some_setting\',
        array(
            \'default\' => \'\',
            \'sanitize_callback\' => \'esc_attr\',
        )
        );

        $wp_customize->add_section(\'some_section\', array(
            \'title\' => __(\'Some Picture\', \'textdomain\'),
            \'priority\' => 10,
            \'sanitize_callback\' => \'esc_attr\',
        ));

        $wp_customize->add_control( new WP_Customize_Cropped_Image_Control( $wp_customize, \'some_setting\', array(
            \'label\'    => __( \'Some Picture\', \'textdomain\' ),
            \'section\' => \'title_tagline\',
            \'height\'      => 250,
            \'width\'       => 250,
            \'flex-width\'  => false,
            \'flex-height\' => false,
            \'settings\' => \'some_setting\',
            \'transport\' => \'refresh\'

        ) ) );

1 个回复
SO网友:Jeff W

是的,如果我遵守策略,那就最好了——正如我在评论中提到的那样,很明显的修复方法是将提供的代码更新到以下&;然后调用设置图像大小,即使我必须先定义图像大小,也解决了问题:

// Some picture
        $wp_customize->add_setting( \'some_setting\',
        array(
            \'default\' => \'\',
            \'sanitize_callback\' => \'esc_attr\',
        )
        );

        $wp_customize->add_section(\'some_section\', array(
            \'title\' => __(\'Some Picture\', \'textdomain\'),
            \'priority\' => 10,
            \'sanitize_callback\' => \'esc_attr\',
        ));

        $wp_customize->add_control( new WP_Customize_Media_Control( $wp_customize, \'some_setting\', array(
            \'label\'    => __( \'Some Picture\', \'textdomain\' ),
            \'section\' => \'title_tagline\',
            \'height\'      => 250,
            \'width\'       => 250,
            \'flex-width\'  => false,
            \'flex-height\' => false,
            \'settings\' => \'some_setting\',
            \'mime_type\' => \'image\',
            \'transport\' => \'refresh\'

        ) ) );

相关推荐

Convert emoji to images

我有一个私有插件,可以导出所有没有“主题化”的帖子,所以输出的只是内容的html(帖子主题为H1,日期/时间为H2)。如果帖子包含表情符号,它会正确显示在主题页面上。但是如果我将HTML输出保存到一个文件中,表情符号会显示为🙁 这些是UniCode字符(我想),我需要生成的HTML页面将表情符号显示为图形图像。创建HTML输出的代码使用标准WP\\u查询对象,然后在have\\u posts循环中输出内容:$thest