My jpg is 4kb, but when I upload it to the server, the PHP program writes it much larger, as 43kb, it's large and fuzzy, instead of being small and clear. How can I maintain the width and height? I've tried resizing after the photo is saved, but nothing happens. This is the code for the upload, and save.
<?php
// retrieve
echo "Request received";
$p= $_FILES["file"];
move_uploaded_file($p["tmp_name"], "pic3-1.jpg");
if ($p==nil) { echo "no photo"; }
// reply
$data = Array("Reply"=>"Imaged saved at server");
echo json_encode($data);
?>
Added to Xcode 8, Swift 3. The resolution is clear:
UIGraphicsBeginImageContext(CGSize(width:75, height: 75))
photo2.draw(in: CGRect(x: 0, y: 0, width: 75, height: 75))
photo=UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.