Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.