开发者

Resizing remote images and saving it to the server

开发者 https://www.devze.com 2023-04-04 12:25 出处:网络
So i made use of this guide and was able to come up with this: <html> <head></head> <body>

So i made use of this guide and was able to come up with this:

<html>
<head></head>
<body>
<form action="process.php" method="get">
<input type="text" name="image"/>
<input type="submit"/>
</form>
</body>
</html>

and process.php i came up with:

 <?php
   include("SimpleImage.php");
   $imgName = $_GET["image"]; //assumi开发者_C百科ng you used GET request and form submits to http://url/script.php?image=something.jpg
   $image = new SimpleImage();
   $image->load($imgName);
   $image->resizeToWidth(250);
   $image->save($imgName);
   echo $imgName;
?>

However something's wrong. It's not saving the image :( I'm completely a PHP noob so i hope you can give some newbie friendly solutions. Thank YOu :)


check your folder/file permission if you are able to read/write on that directory. If you have not set a path on where to save the new image, usually it writes to the same directory where your process.php is located.

0

精彩评论

暂无评论...
验证码 换一张
取 消