What should I do if I want to implement the following?
·Image upload
·Arrange
until the specified size (in XY direction)
·Save as a single image
Question
"·After uploading the image, I think I saw an ImageMagic sample online that magnifies the image itself and trims the image itself, but I don't know what to do with ""arranging it until the specified size""
"
·After displaying it side by side in CSS, capture the elements?
·Even if you don't do that, can you do something with ImageMagic?
Other
·The joints are not seamless, just repeat the arrangement
·It doesn't have to be ImageMagic
It seems to be easy to implement with GD.
I don't know what to do with the overhanging sample below, so I try to overhanging it.
I didn't check if the image was POSTed, so please try to insert it yourself.
<?php
// Image Height to Specify
$maxHeight=(int)$_POST['max_height'];
// Width of image to specify
$maxWidth=(int)$_POST ['max_width'];
// uploaded image
$image=$_FILES['image']['tmp_file'];
// Divided by /
$mimeType=explode('/',$_FILES['image']['type']);
if($mimeType[1]==='jpeg'||$mimeType[1]==='png'||$mimeType[1]==='gif'){
// GD the uploaded image
$functionName='imagecreatefrom'.$mimeType[1];
$gdImage=$functionName($image);
// image height
$imageHeight=imagesy($gdImage);
// image width
$imageWidth=imagesx($gdImage);
// GD for copy
$result=imagecreateruecolor($maxWidth,$maxHeight);
// Number of vertical copies (floor if not overhanging)
$copyY=ceil($maxHeight/$imageHeight);
// Number of horizontal copies (floor if not overhanging)
$copyX=ceil($maxWidth/$imageWidth);
// copy away
for($y=0;$y<$copyY;$y++){
for($x=0;$x<$copyX;$x++){
imagecopy($result,$gdImage,$x*$imageWidth,$y*$imageHeight,0,$imageWidth,$imageHeight);
}
}
// output the results of
$outputFunctionName='image'.$mimeType[1];
$outputFunctionName($result,'./output.'.$mimeType[1]);
}
581 PHP ssh2_scp_send fails to send files as intended
912 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
617 Uncaught (inpromise) Error on Electron: An object could not be cloned
572 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
© 2024 OneMinuteCode. All rights reserved.