dougong2306 2013-05-02 21:16
浏览 32

使用imagecreatefromjpeg上传的图像后重定向

I'm currently trying to use the GD library to crop and upload an image. I upload the image first to the server and save the url to the image which I then pass to the following script which reads the original uploaded image and it crops it according to the coordinate that I give it.

<?php

   $w = $h = 150;
   $quality = 90;

   $src = $_POST['path'];
   $img = imagecreatefromjpeg($src);
   $kak = ImageCreateTrueColor( $w, $h );
   imagecopyresampled($kak,$img,0,0,$_POST['x'],$_POST['y'],
   $w,$h,$_POST['w'],$_POST['h']);

   header('Content-type: image/jpeg');
   imagejpeg($kak,'c.jpg',$quality);
   imagedestroy($img);
?>

All works fine, image upload, crop and cropped image upload. The problem is that this page is completely empty and I would like to redirect the visitor to a different page but if I add

header ("Location: nextpage.php");

at the end of my php script it obviously redirects before finishing uploading. Does anyone know how to do this once the file has been uploaded successfully?

Thanks in advance

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
    • ¥500 火焰左右视图、视差(基于双目相机)
    • ¥100 set_link_state
    • ¥15 虚幻5 UE美术毛发渲染
    • ¥15 CVRP 图论 物流运输优化
    • ¥15 Tableau online 嵌入ppt失败
    • ¥100 支付宝网页转账系统不识别账号
    • ¥15 基于单片机的靶位控制系统
    • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
    • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?