user1008793
user1008793

Reputation:

PHP AJAX - upload and crop

I found a script - Upload and Crop image on this website http://onlinewebapplication.com/2011/08/image-upload-cropping-php-jquery.html Everything works fine, but I need to add my new name for new images...

When I upload an image -> before crop I can change file name, but it works only for big images, for thumb I don't have an idea because the variables are sent by AJAX.

My version works here - link first input is for file path, second for new filename..

I need change name for big image and thumb, but it works only for big. How send variable "image_name" to ajax_image.php ?

Anyone ? Please help me, I need this ..Thanks

Upvotes: 0

Views: 1185

Answers (1)

Melsi
Melsi

Reputation: 1462

You can change the name for the big image in this line:

$actual_image_name = time().substr($txt, 5).".".$ext;

and for the small image you can pass the name as parameter by changing this:

url:"ajax_image.php?t=ajax&img="+$("#image_name").val()+"&w="...etc

to this:

url:"ajax_image.php?sname=blabla&t=ajax&img="+$("#image_name").val()+"&w="...etc

also for the small image again change in ajax_image.php this:

$new_name = "small".$session_id.".jpg"; // Thumbnail image name

to this:

$new_name = "smallqa".$_GET['sname'].".jpg"; // Thumbnail image name

Upvotes: 1

Related Questions