thanks for this module its really just the image module i have been looking for.

but the watermark part is kind of confused me, i have tested this module on my test site which seem wokring just fine,
but when installed this on my production site, after upload an image i keep getting this error message:"Image file watermark.png not found. Error while watermarking an uploaded image."

while i am using the same watermark.png file from the test site and folder location etc...i have checked both sites are using ImageMagic toolkit,both private file system etc.. the only different would be some of the modules on the production site is not installed on the test site..

could you indicate which module could potentionlly causing this issue? i am pulling my hair here but still have no clue.....

CommentFileSizeAuthor
#4 errormsg.jpg27.28 KBlyyfever

Comments

hutch’s picture

There are two ways to use watermarks,
1) As admin in admin/settings/imagepicker "Default Watermark image:" in which case it is globally applied to all images.

This one requires a path relative to the drupal root, but you could experiment and try a full filesystem path, it might work.
This has to be a pathing problem.

2) If no global default image is defined then users can each have their own, I'm assuming you are using 1)

I just noticed you mention private file system, I can't vouch for how that will behave with imagepicker.

lyyfever’s picture

thanks for the reply,

Yep, i defined an watermark.png in backend setttings under imagepicker, yes it will use a default path,which is sites/default/files/imagepicker/1/watermarks where i found out if i leave it blank it will display this in warning message.

so i just put in watermark.png into that folder, the settings will pass.

but it will says cann't find watermark.png when i upload images through imagepicker..

strangely i have this setup on my testing site (seperate setup on the same hosting), it also have private file system, also have image.module also using GD2 toolkit, all the things i can think of may related with imagepicker.(there are some modules different)
and it works fine on the testing site...just dont work on my production site...:(

hutch’s picture

Try putting watermark.png in the drupal root and entering just the filename in "Default Watermark image:", no slashes
Test that and if it works then move the file to 'sites/default/files' and put 'sites/default/files/watermark.png' in and test again. Keep trying different places. As you are using private filesystem this might be the cause of it not being found.

lyyfever’s picture

StatusFileSize
new27.28 KB

hi thanks for replying, i did what you have suggested, a error message will display as in the attached jpg.

hutch’s picture

1) does the file exist on the path shown?
2) are the permissions such that it can be reached?

lyyfever’s picture

hihi,

sorry i didnot made the condition clear, what i did was i have put the watermark file the.png in the root folder of drupal,but image picker will however always decide to looking the file under the path as shown in the attached screenshot above.

however if i do put the file in the folder that imagepicker is looking for, i won't get this message,setting watermark will pass, but when i came to upload an image it will say "Image file the.png not found. Error while watermarking an uploaded image."

ok all the folders such as watermarks,or any folder that imagepicker related are 755 permissions.

i know this may get confusing as i am using private file system which i have to(i need to control file download around my site by user role).

it seems that i cannot define my own physical path for the watermark image file, the imagepicker always looking for the file under SYSYTEM File path/imagepicker/1/watermarks/..
in a more programmer way:
under imagepicker.module line 14
define('IMAGEPICKER_WATERMARK_DIR', 'watermarks');
that defined the watermarks folder.

under imagepicker.imagefuncs.inc line 31

/**
 * Adapted from watermark module.
 *
 */
function imagepicker_watermark_process($image_path, $account=FALSE) {
  if ($account) {
    $user = $account;
  }
  else {
    global $user;
  }
  $watermark_path = variable_get('imagepicker_watermark_image', FALSE);
  $use_global_watermark = ($watermark_path ? TRUE : FALSE);
  if (! $watermark_path ) {
    $watermark_path = ($account->imagepicker_watermark_image ? $account->imagepicker_watermark_image : FALSE);
  }
  if (! $watermark_path ) {
    return FALSE;
  }
  // init return status
  $status = FALSE;

  if ($use_global_watermark) {
    $scaling = variable_get('imagepicker_watermark_scaling', FALSE);
    $position = variable_get('imagepicker_watermark_position', 0);
  }
  else {
    $scaling = ($user->imagepicker_watermark_scaling ? $user->imagepicker_watermark_scaling : FALSE);
    $position = ($user->imagepicker_watermark_position ? $user->imagepicker_watermark_position : 0);
    $wdir = imagepicker_get_watermarks_dir($user);
    $watermark_path = $wdir . DIRECTORY_SEPARATOR . $watermark_path;
  }

ok, i dont know anyone else or just me, in the backend under watermark settings it says:"If this field is left empty users with access will have the option to apply their own watermark."
i have tested on two site, where i left this filed empty, but when i upload images, there is no option appears for me to apply my own watermark file?
which i believe is that this else statement doing above.
more info about this user watermarks options-what i meant is this checkbox from image picker.upload.inc line 78

if ( imagepicker_image_check_functions(TRUE) && variable_get('imagepicker_watermark_enable', 0)) {
    if (! variable_get('imagepicker_watermark_image', '')
      && ($user->imagepicker_watermark_image ? $user->imagepicker_watermark_image : FALSE)
      && $user->imagepicker_watermark_enable) {
      $form['watermark'] = array(
        '#type' => 'checkbox',
        '#title' => t('Use watermark'),
        '#description' => t('Use watermark on this image.'),
        '#default_value' => ($user->imagepicker_watermark_use ? $user->imagepicker_watermark_use : FALSE),
      );
    }
    elseif (variable_get('imagepicker_watermark_image', '')) {
      $form['watermark'] = array(
        '#type' => 'hidden',
        '#value' => 1,
      );
    }
  }

is not showing.
the above also shows the elseif statement should the global function which is calling the watermark filed value from imagepicker.admin.inc
and it seems its have trouble finding it when i have defined the watermark file.

this is very frustraing because everything working for me on my testing site (on the same hosting), also a private file system, only different is the modules are different..

if you have read this far, sorry for bother you and there properly no bug in this module, i will try if i can tweak the code to make it accepting watermark files outside of the SYSTEM file folder to get around with the private system.

sw3b’s picture

Same thing for me !
It always chose to go in files/imagepicker/1/watermarks. It does not go with relative path. After you specified the correct path with the file correctly place you're able to save the config. But when you upload it says unable to watermark file.

Any help on this issue ?
Thanks

hutch’s picture

Version: 6.x-2.5 » 6.x-2.x-dev

I have just revisited the watermarks feature and did find a bug in the validation on the administration side, this has been fixed and commited to 6.x-2.x-dev in CVS. This fix will appear after midnight GMT

While I was at it I thoroughly tested watermarks, both as a global one as entered in admin/settings/imagepicker/general (eg "sites/default/files/watermark.png" and installed directly, not using imagepicker. I also tried "sites/default/files/imagepicker/1/watermarks/watermark.png" and that worked too) and as a user, uploaded with the form in My account > My imagepicker > Config, both worked for me.

Please make sure you have read #1 of this thread.

hutch’s picture

Status: Active » Closed (fixed)