简体   繁体   English

如何在react-CKEditor组件中固定图像的宽度和高度?

[英]How to fix width and height of the image in the react-CKEditor component?

How to reduce the size of the image from original image size in CKEditor. 如何在CKEditor中从原始图像尺寸减小图像尺寸。

 <button type='button' className="ml-2 mr-0 btn btn-primary" onClick={this.logSig.bind(this)}>submit</button>

  logSig = () => {

    const signaturedata = this.signaturePad.toDataURL();
    const signatureImg = '<img alt src=' + signaturedata + '/> ';
    const { editorContent, signDialogOpenedFor } = this.state;

    let elem = editorContent ? this.getElemForPDF(editorContent, signDialogOpenedFor, signatureImg) : signatureImg;

    this.setState({
        openSignatureDialog: false,
        signDialogOpenedFor: '',
        editorContent:elem
    });
}

we are inserting the signature image from the dialog box to the editor. 我们正在将签名图像从对话框插入编辑器。

in the editor after inserting the image it is of size 300 * 150 在插入图像后在编辑器中,图像的大小为300 * 150

From image-2 from size 300 * 150 i need to fix it with 200 * 100 in the editor. 从大小300 * 150的image-2中,我需要在编辑器中使用200 * 100对其进行修复。 Thanks in advnace 提前感谢

您不能只在您的签名图像常量中添加宽度和高度吗?

    const signatureImg = '<img alt src=' + signaturedata + ' width=200 height=100/> ';

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在反应中创建动态高度宽度图像组件 - Create a dynamic height width image component in react 如何使用 React 从 props 自定义组件的形状高度和宽度 - how to customize the shape height and width of a component from the props using react 在此代码中如何确定宽度和高度为% - How to fix width and height is % in this code 如何在反应中设置背景图像内联样式的高度和宽度 - How to set height and width of background image inline style in react antd 图片上传 需要将基于 class 的组件转换成 react -hooks 无法增加图片的宽高 - antd image upload Need to convert class based component into react -hooks and unable to increase the width and height of image CKEditor在插入元素之前获取图像的宽度和高度(预加载) - CKEditor Getting image width and height before inserting element (preloading) CKEditor图像的宽度和高度作为HTML属性代替内联样式 - CKEditor image width and height as HTML attribute in stead of inline styling 无法设置组件的背景图像宽度和高度 - Unable to set background image width and height of component 如何在React中根据宽度动态设置图像高度? - How do I dynamically set image height based on width in React? 如何在本机反应中将图像宽度设置为 100% 并将高度设置为自动? - How to set image width to be 100% and height to be auto in react native?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM