我需要上传到一个文件夹使用php图像
我需要上传到一个文件夹使用php的图像 我使用Cropit插件 链接: 这是我的密码: Jquery:我需要上传到一个文件夹使用php图像,php,jquery,image,resize,crop,Php,Jquery,Image,Resize,Crop,我需要上传到一个文件夹使用php的图像 我使用Cropit插件 链接: 这是我的密码: Jquery: <script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script> <script src="pro_pic_crop_mobile/jquery.cropit.js"></script> 首先,我提交图像,然后使用jquery将base
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>
<script src="pro_pic_crop_mobile/jquery.cropit.js"></script>
首先,我提交图像,然后使用jquery将base64值放入div id,然后我想使用php将调整大小的图像上载到文件夹中
提前感谢所有人:)一种方法是使用
<style>
.cropit-preview {
background-color: #f8f8f8;
background-size: cover;
border: 1px solid #ccc;
border-radius: 3px;
margin-top: 7px;
width: 436px;
height: 580px;
}
.cropit-preview-image-container {
cursor: move;
}
.image-size-label {
margin-top: 10px;
}
input {
display: block;
}
button[type="submit"] {
margin-top: 10px;
}
#result {
margin-top: 10px;
width: 900px;
}
#result-data {
display: block;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
word-wrap: break-word;
}
</style>
<div align="center">
<form id="img" name="img" method="post" action="#" enctype="multipart/form-data">
<div class="image-editor">
<input type="file" class="cropit-image-input">
<div class="cropit-preview"></div>
<div class="image-size-label">
Resize image
</div>
<input type="range" class="cropit-image-zoom-input">
<input type="hidden" name="image-data" class="hidden-image-data" />
<input name="submit" type="submit" value="Submit" />
</div>
</form>
<div id="result">
<code>$form.serialize() =</code>
<code id="result-data"></code>
</div>
</div>
<script>
$(function() {
$('.image-editor').cropit();
$('form').submit(function() {
// Move cropped image data to hidden input
var imageData = $('.image-editor').cropit('export');
$('.hidden-image-data').val(imageData);
// Print HTTP request params
var formValue = $(this).serialize();
$('#result-data').text(formValue);
// Prevent the form from actually submitting
return false;
});
});
</script>
<?php
$randomDiv =
"<div id='myId' class='myClass'>
//inner elements
</div>";
$documentObj = new DOMDocument();
$documentObj->loadHtml($randomDiv);
$elementObj = $documentObj->getElementsByClassName('myClass');
echo($elementObj[0]->getAttribute('id'));
?>