Jump to content

[SOLVED] Grab/Resize/Crop an image


Zipp425

Recommended Posts

Im trying to make a PHP backend for this tool

 

Using Ajax, I pass resize2.php?resize=true&src=http://localhost/imageEditor/me.jpg&w=400&h=200&s=1&x=0&y=100

 

Heres what I currently have in the php file, but it says that Im not using a valid image resource

if($_GET['resize'] = true){

$filedir = '../images/'; // the directory for the original image
$prefix = date('mdy_His_'); // the prefix to be added to the original name

$maxfile = '2000000';
$uploadDir = $filedir.$prefix.'upload.jpg';
$srcImg = imagecreatefromjpeg($_GET['src']);
imagecopyresampled($uploadDir,imagecreatefromjpeg($_GET['src']),0,0,$_GET['x'],$_GET['y'],$_GET['w'],$_GET['h'],400,400);

}

 

Any help on this subject would be great. also, let me know if you have any questions.

Link to comment
https://forums.phpfreaks.com/topic/47588-solved-grabresizecrop-an-image/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.