Won't accept Default Watermark image field

RusRabbit - September 4, 2009 - 09:43
Project:Image Picker
Version:6.x-2.3
Component:User interface
Category:task
Priority:normal
Assigned:Unassigned
Status:active
Description

The field "Default watermark image" turns red and don't accept any path. I tried to enter path relative to Drupal root, server root, absolute paths. I tried to change file permissions. Neither works. Did I do something wrong?

If I leave the field empty, there is no option to apply my own watermark. Where is it supposed to be?

Thank you!

#1

hutch - September 4, 2009 - 14:01

If, under admin/settings/imagepicker, you "Enable Watermarks in Imagepicker" and leave the path empty you should get the option under "My Imagepicker"

If you fill in the "Default Watermark image" field with the path to the already uploaded file (no leading slash) and it exists you will not be able to select your own under My Imagepicker

This has been tested repeatedly and it works. Wether it works on Windows I do not know, perhaps you will have to use backslashes there.

#2

RusRabbit - September 5, 2009 - 16:47

Well, I enter to the field: sites/all/modules/files/watermark.png

And there's the error message:

This file does not exist or has invalid path: /srv/www/clients/client1/web3/web/sites/default/files/imagepicker/1/watermarks/sites/all/modules/files/watermark.png

Did I musconfigure Drupal?

By the way, I just finished migrating from alpha filesystem to numeric while I had already 12.000 files and more that 200 users.
This was such an experience! I had to write script to update image path in all the nodes, teasers and comments. And also there's a problem in automatic conversion, if the script runs out of time - all the folders are screwed up, and the second run doesn't help. That's what happened to me.
Dunno, but changing FastCGI settings on my server didn't help to run scripts longer.
Also I would suggest to have an option to skip validation, as sometimes (as in my case) it is almost impossible to manage all the requirements.

#3

hutch - September 5, 2009 - 20:04

does the folder
/srv/www/clients/client1/web3/web/sites/all/modules/files exist?

You seem to have two files folders

If you upload watermark.png to the drupal root /srv/www/clients/client1/web3/web/
and put just watermark.png in the box and see if that works

php timeouts are a problem, especially if you do not have root access
You could try adding it to .htaccess

12000 images!

I did try to write the changeover routines with memory in mind but timeouts are harder to deal with, php "protects" itself from ordinary users ;-(

I hope you manage to get it sorted

#4

RusRabbit - September 6, 2009 - 14:28

Thank you! I did manage the images to get sorted.

Here's the code I used for nodes, teasers and comments conversion. The following example is for nodes; for teasers and comments we have to put correct table name (comments for comments) and columns names respectively (tid, cid instead of nid and teaser, comment instead of body). I put the code into the block on a certain page while site is offline, just for ease of use. The code is written to handle non-latin folder names, too (I had some folders named in Russian).

<?php

$sql
= "SELECT name, uid FROM {users}";
$result = db_query(db_rewrite_sql($sql));
while (
$userinfo = db_fetch_object($result)) {
  
$utfname=$userinfo->name;
  
$utfname = rawurlencode($utfname);
  
$username[$utfname] = $userinfo->uid;
}


$nodez = db_query('SELECT nid, body FROM {node_revisions}');
while (
$mynode = db_fetch_object($nodez)) {
  
$editnode = $mynode->comment;
  
$currentnid = $mynode->nid;

  
$search = '/(imagepicker\/)([a-z]{1,}\/)([a-zA-Zа-яА-Я0-9_.-\s\+\%]{1,})/e';
  
$replace = '"$1".$username["$3"]';
  
$result = preg_replace($search, $replace, $editnode);

db_query("UPDATE {node_revisions} SET body = '$result' WHERE nid = $currentnid");
}

?>

#5

hutch - September 6, 2009 - 17:17

Thank you very much for the code, I have added it to my CVS sandbox and will commit along with the next fix ;-)
I hope the Russian lettering survives.

#6

RusRabbit - September 6, 2009 - 17:52

Just to mention, this php regular expression works only for latin and russian alphabets in folder names. We need to fix it to work with any alphabet.

#7

hutch - September 6, 2009 - 18:19

True enough, but how? I initially saved it as utf8 but the Russian characters were not recognized. I copied the regex from the source on firefox, set my text editor to Cyrillic iso 8859-5 (just a guess) and they displayed correctly.

I suspect that the regex will have to be altered for each use.

 
 

Drupal is a registered trademark of Dries Buytaert.