PHP file upload image + Canvas php resize -
i'm creating file uploads script website , using canvas.php scale down image. upload works fine scaling doesn't. i've never used before i'm hoping it's minor error. here code:
<?php $newfilename = $id; $extension = end(explode(".", $_files["file"]["name"])); $path = "../posts/$type/"; //insert table if(mysqli_affected_rows($con)>0){ move_uploaded_file($_files["file"]["tmp_name"],"$path" . $newfilename . "." . $extension); header("location: ../dashboard.php?page=posts"); exit(); } else{ header("location: ../404.php"); } ?> <?php if($type == "photo"){ require_once "canvas.php"; $img = new canvas("$path" . $newfilename . "." . $extension); $img ->resize("700") ->save("$path" . $newfilename . "." . $extension); } ?> this uses canvas.php (http://canvas.daviferreira.com/)
Comments
Post a Comment