查看文件: uptestif.php
大小: 1.7 KB
类型: application/octet-stream
<?php require_once('../Connections/BE2.php'); ?> <? if (isset($_POST["MM_update"]) && $_POST["MM_update"]=='fp1' ) { $tfile1="fileToUpload1"; $filename = $_FILES[$tfile1]['name']; $filePath = $_FILES[$tfile1]['tmp_name']; $exif = exif_read_data($_FILES[$tfile1]['tmp_name']); if (!empty($exif['Orientation'])) { $imageResource = imagecreatefromjpeg($filePath); // provided that the image is jpeg. Use relevant function otherwise switch ($exif['Orientation']) { case 3: $image = imagerotate($imageResource, 180, 0); break; case 6: $image = imagerotate($imageResource, -90, 0); break; case 8: $image = imagerotate($imageResource, 90, 0); break; default: $image = $imageResource; } } // else { move_uploaded_file($_FILES[$tfile1]["tmp_name"],$spic); } // imagejpeg($image, $filename, 90); imagejpeg($image,'/www2/skybni/upimg/tmp'.rand(0,99999).'.jpg', 90); imagedestroy($imageResource); imagedestroy($image); } ?> <form action="" method="post" name="fop1" id="fop1" enctype="multipart/form-data"> <div class="form-group"> <label class="col-md-4 control-label" for="passwd1"> 上傳雲名片頭像</label> <div class="col-md-8"> <input name="fileToUpload1" type="file" id="fileToUpload1" /> <input type="hidden" name="MM_update" value="fp1" /> <button type="submit" class="btn btn-primary">保存</button> </div> </form>
保存
取消
返回文件列表