4

How can I add through the form API an image upload field with the cropping functionality implemented by this module?

http://drupal.org/project/imagefield_crop/

I'm using Drupal 7. I need to implement an image upload field with cropping functionality. If there's another module that does the same job as Image Crop and plays more nicely with the form API, that's fine.

  • here is a list of exists modules: drupal.org/node/1179172 may help! – Mohammad Ali Akbari Aug 24 '12 at 7:06
  • I'm still crawling through this (excellent) list, but so far none of these have a documented example of integrating with the Form API directly. The dev copy of Imagefield_crop 2.0-dev has some hope, but still no solution yet. drupal.org/node/1602220 – Citricguy Aug 25 '12 at 1:50
  • Creating a new content type, modifying it with hook_form_alter() and hijacking the submit function will work, as Imagefield_crop (and every other drupal image cropping tool) works this way natively, but this seems wrong on several levels. – Citricguy Aug 25 '12 at 1:54
0

I ended up getting this working by using a module called Form Block and just putting the block containing the node form in the content. For some reason I never figured out, just calling drupal_get_form on that node form just did not work, even with the right node module files included. So, hopefully someone else struggling with this will be able to learn from this question

  • It was a great question. I would still be interested in seeing how this could be possible using only the Form API. I'm guessing this will be easier to implement in D8. – Citricguy Aug 25 '12 at 12:28
  • I basically recreated the entire form to try and make it work - to no avail. There must be a difference between the front end and back end way up the call stack that let it work in one place and not another. The answer I suspect is in the Form Block module's code. – tvanc Aug 26 '12 at 16:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.