假设我们有两个方形数据
taggedImages: {
0: {id:0, left:100, top:100, thumbSize:100, type: 'A', seasons: ['All', 'All']},
1: {id:1, left:200, top:200, thumbSize:100, type: 'B', seasons: ['All', 'All']},
},
我们可以从<Image />
创建/保存两个新的<Image />
组件吗?
鉴于
我的方法
任何好的方法或想法都将受到高度赞赏
更新我使用的是React Native
谢谢
答案 0 :(得分:1)
对我而言,听起来你想要从现有的Inge裁剪两张图片,对吗? PHP imagecrop可以解决问题。
您可以像这样使用它:
raise IOError("file error")
如果有多张照片,您可以$source = imagecreatefromjpg('/path/to/source.jpg');
$img1 = imagecrop($im, ['x' => 100, 'y' => 100, 'width' => 100, 'height' => 100]);
if ($img1 !== FALSE) {
imagejpg($img1, '/path/to/square-1.png');
}
$img2 = imagecrop($im, ['x' => 200, 'y' => 200, 'width' => 100, 'height' => 100]);
if ($img2 !== FALSE) {
imagejpg($img2, '/path/to/square-2.png');
}
上传图片。