Failure loading avatars [message #34461] |
Wed, 01 November 2006 12:53 |
steenbras
Messages: 9 Registered: November 2006
Karma: 0
|
Junior Member |
|
|
Hi. I've done an extensive search for this but can't seem to find anything related to my setup...
I can't upload avatars from a local file on my machine. When I try, I get the message: "The specified url does not contain a valid image". The file I'm loading is a jpg and is only 3k large. I've also tried loading a gif.
This is with configuration pretty much out of the box.
This is my config:
- FUDforum 2.6.0 (FUDeGW) on eGroupWare version 1.2.105. This is all on an
- FUDforum 2.6.0 (FUDeGW)
- eGroupWare version 1.2.105
- XP Pro Box (sp2)
- XAMPP for Windows Version 1.5.4a
- PHP 5.1.6
- Apache 2.2.3
- MySQL 5.0.24a-community-nt
The Apache server is running under the SYSTEM identity so should have all privileges needed.
Any help greatly appreciated.
|
|
|
Re: Failure loading avatars [message #34475 is a reply to message #34461] |
Fri, 03 November 2006 14:39 |
steenbras
Messages: 9 Registered: November 2006
Karma: 0
|
Junior Member |
|
|
Pretty quiet on here at the moment!
Been doing some more digging, and I'm getting further, but it's still not working properly. (Please bear with me on this long posting).
The reason I was getting the "Specified url does not contain a valid image" was because of the default value of upload_tmp_dir in php.ini which xampp set during install - the directory separators were \ rather than / or \\ so were being treated as escape characters.
The net effect was that the full path returned by the "tmp_name" element of the $_FILES array was a path missing separators, so obviously no url was found.
I fixed this by changing the upload_tmp_dir to use forward slashes, and then, at least, the code got as far as safe_tmp_copy in register.php. This was where I hit the next snag. is_uploaded_file always returns false, and therefore move_uploaded_file always failed. I couldn't overcome this without a change to code (very reluctant to do that but I can't see another way of doing it), so I made this code change:
if (!move_uploaded_file($source, ($name = tempnam($GLOBALS['TMP'], $prefx.'_')))) {
if (!copy($source, $name))
return;
}
Sort of negates the whole point of move_uploaded_file so I'm more than willing to take advice here.
HOWEVER - that then leads to my latest stumbling block. Now the avatar will not copy to the custom_avatars folder - I always get this error:
Warning: copy(D:\Work\PHP\egroupware/fudforum/3814588639/images/custom_avatars/) [function.copy]: failed to open stream: Permission denied in D:\Work\PHP\egroupware\fudforum\3814588639\theme\default\register.php on line 1657
(Please ignore the line number poss not corresponding to yours - I've got loads of echos in there to try to work out what's going wrong)
The offending line is this one:
copy($TMP . basename($common_av_name), $WWW_ROOT_DISK . $av_path);
My echo statements tell me this:
- The source file exists
- The target folder exists
I have also successfully been able to copy it to a file name generated by tempnam($GLOBALS['TMP'], $prefx.'_').
The Apache process runs under the windows SYSTEM account and this has full control access to the custom_avatars folder. I have even run SysInternals FileMon and this shows no permission problems from the OS side.
But now I'm completely stuck. I'm pulling my hair out and would greatly appreciate some help. Apologies for the long post.
|
|
|
Re: Failure loading avatars [message #34506 is a reply to message #34475] |
Sun, 05 November 2006 17:44 |
Ilia
Messages: 13241 Registered: January 2002
Karma: 0
|
Senior Member Administrator Core Developer |
|
|
What are the permissions of the source & destination directories? Make sure that all users on the system are allowed to write to them.
Also you may need to convert \ to /.
FUDforum Core Developer
|
|
|
|
|
|
|
Re: Failure loading avatars [message #34541 is a reply to message #34538] |
Mon, 06 November 2006 18:12 |
Ilia
Messages: 13241 Registered: January 2002
Karma: 0
|
Senior Member Administrator Core Developer |
|
|
The weird backslash \ is added by PHP since it always adds the system's default directory separator to the generated URL. My suggestion would be that you try to use something other then _ as a separator in the hope win32 keeps it. Perhaps a - or alike.
FUDforum Core Developer
|
|
|
|
Re: Failure loading avatars [message #34572 is a reply to message #34543] |
Tue, 07 November 2006 17:02 |
Ilia
Messages: 13241 Registered: January 2002
Karma: 0
|
Senior Member Administrator Core Developer |
|
|
tempnam's separator length depends on the OS, in most cases there are no length restrictions.
FUDforum Core Developer
|
|
|
|
Re: Failure loading avatars [message #34594 is a reply to message #34582] |
Wed, 08 November 2006 17:51 |
Ilia
Messages: 13241 Registered: January 2002
Karma: 0
|
Senior Member Administrator Core Developer |
|
|
1) That would be a PHP problem if it is indeed the case.
2) Fixed in FUDforum's code.
3) This is fixed in FUDforum code.
FUDforum Core Developer
|
|
|
|
Re: Failure loading avatars [message #34620 is a reply to message #34596] |
Fri, 10 November 2006 11:37 |
steenbras
Messages: 9 Registered: November 2006
Karma: 0
|
Junior Member |
|
|
Hi again Ilia.
There's something I just don't understand... whenever I rebuild the theme I have to apply the change that renames the "reads" alias. I have changed the code in setup/base/src/forumsel.inc.t to this:
$c = q('SELECT f.id, f.name, c.name, c.id, CASE WHEN '.$GLOBALS['usr']->last_read.' < m.post_stamp AND (fr.last_view IS NULL OR m.post_stamp > fr.last_view) THEN 1 ELSE 0 END AS rreads
but for some reason the old statement keeps getting resurrected in msg.php, thread.php, threadt.php and tree.php - always goes back to this:
$c = q('SELECT f.id, f.name, c.name, c.id, CASE WHEN '.$GLOBALS['usr']->last_read.' < m.post_stamp AND (fr.last_view IS NULL OR m.post_stamp > fr.last_view) THEN 1 ELSE 0 END AS reads
I've even tried changing them manually to use a different alias, but a rebuild always resets it. There's no other occurrence of that statement that I can see.
[Updated on: Fri, 10 November 2006 11:37] Report message to a moderator
|
|
|
Re: Failure loading avatars [message #34629 is a reply to message #34620] |
Fri, 10 November 2006 16:01 |
Ilia
Messages: 13241 Registered: January 2002
Karma: 0
|
Senior Member Administrator Core Developer |
|
|
You are modifying the base sources, which are only used when the forum is installed. You need to find the generated src/ directory and adjust the forumsel.inc.t file in it.
FUDforum Core Developer
|
|
|