Jump to content

Saving image


dweb

Recommended Posts

Hi

 

I'm really new to php and could really do with some help.

 

I am using the following script

 

http://test.dpetroff.ru/jquery.iviewer.test/test/

 

which basically allows me to position an image within a DIV area

 

My question is, how can I get PHP to save just the image within the DIV area, so it's almost acting like a crop tool

 

I've tried a few things but so far not managed to get anything working

Link to comment
https://forums.phpfreaks.com/topic/262450-saving-image/
Share on other sites

Moving an image around in javascript is vastly different than cropping an image in PHP.  I know it seems like it would be simple, but none of the code that does this viewing stuff is even PHP, it's all JavaScript.

 

You would have to figure out the top-left and bottom-right corners of the "view port" as they relate to the image itself (you may not even have these figures).  Then you'd have to post the image and the coordinates to a PHP script.  Load the image using the gdimage library (which you may have to compile into PHP), create a new blank image of the appropriate size, and then use one of the imagecopy functions (like imagecopyresize) to copy the portion of the larger image into the new smaller image.  Then save the new smaller image inside your web directory and serve it back using an <img /> tag.

Link to comment
https://forums.phpfreaks.com/topic/262450-saving-image/#findComment-1345005
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.