I've just installed the Jcrop Form Element module to try and add jcrop on an image in a custom module form. After playing around with it for a while, however, I've noticed that you can change the location of the main image, but the cropped image always seems to end up in sites/default/files, couldn't find anything in the readme about another option that I missed, so submitting this.

Comments

jhyrith’s picture

I'm using the temporary fix of changing line 205

  $file_to_edit = file_copy($src, 'public://', $replace = FILE_EXISTS_RENAME);

to

   $file_to_edit = file_copy($src, 'public://profile/'.$GLOBALS['user']->uid.'/profilepictures', $replace = FILE_EXISTS_RENAME);

at the moment, a better solution would be appreciated!

jhyrith’s picture

I've looked into making a better fix for this now, if you change line 205 in the jcrop_fapi.module to:
$file_to_edit = file_copy($src, $element['#jcrop_settings']['cropped_upload_location'], $replace = FILE_EXISTS_RENAME);

and add:

'cropped_upload_location' => 'public://'

to the '#jcrop_settings' array at line 29 you can then use

$settings['cropped_upload_location'] = 'public://custom_location/'; in your defined '#jcrop_settings' array to customize the upload location of your cropped images in your custom forms without restricting it so much as my quick fix.

Would be a great addition to the next version :)

Thanks

jhyrith’s picture

Category: Bug report » Feature request
Status: Active » Needs review

adci_contributor’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.