profile pictures do not work

profile pictures do not work

by Glenn Brown -
Number of replies: 22

When a user uploads a photo, it appears as a white box with a red x in the top corner. Anyone who does not upload a photo gets the smiley face. I changed the smiley face to another Jpeg and it also worked as a default user. However, users still get the white box when they upload their own photo jpg.

Any ideas?

Average of ratings: -
In reply to Glenn Brown

Re: profile pictures do not work

by Zbigniew Fiedorowicz -

Right click on the white box and go to the Properties item.  Then enter the URL that is shown for that directly into your browser.  What error message do you get?  One possible cause for this might be the following item in the FAQ: http://moodle.org/mod/glossary/view.php?id=1024&mode=letter&hook=U&sortkey=CREATION&sortorder=asc

In reply to Zbigniew Fiedorowicz

Re: profile pictures do not work

by Marc Dastous -
I tried to cut and paste the URL from the image and did not get an error; just the white box/red X as the gentleman described.

Funny this is, I have 2 domains running on the exact same server, one domain http://socialstudies4u.com/moodle/ works fine. The other, http://gis4u.com/moodle is experiencing this problem.

I have compared the permissions for each domain and they are identical. SS4U was a clean install and never had courses associated with it. GIS4U was an upgrade that had courses associated with it. Whether this has any bearing on the problem I do not know.

I am able to upload and view any other file types through the moodle interface (ie. sumitted assignments, etc), but no user profile images. I also see the smiley face, but no user uploaded pix. Is there a restriction on image dimensions that would allow the image to not be viewed if it is larger than the frame?

Need to solve this problem. Everything was fine until I upgraded to 1.2. While this is not a critical issue to the function of the site, the aesthetics leave something to be desired.

Please help with this problem, it seems MANY people are experiencing this issuesmile

Marc

In reply to Zbigniew Fiedorowicz

Re: profile pictures do not work

by Marc Dastous -
Ok,

I tried copying the link in Mozilla and it says
The image "" cannot be displayed, because it contains errors.

What is causing the error?

Marc

In reply to Marc Dastous

Re: profile pictures do not work

by Martin Dougiamas -
Picture of Core developers Picture of Documentation writers Picture of Moodle HQ Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers
I reckon you have blank lines in your config.php
In reply to Martin Dougiamas

Re: profile pictures do not work

by Marc Dastous -
I have attached my config.php.

I do not see any spaces at the end of file in PHP Edit. The file ends on line 161. Is that the end of the file?

Marc

In reply to Martin Dougiamas

Re: profile pictures do not work

by dan roggenkamp -
Indeed this was the source of the problem for me.

If you're getting the error message, '... can not be displayed, because it contains errors', check for blank lines in your config.php file. Mine was at the very end, and was no doubt the result of my carelessness when I copied and pasted during setup.
In reply to Glenn Brown

Re: profile pictures do not work

by Teemu Sumi -
Is GD installed? Can you see the graphics of the logs?

Teemu
In reply to Glenn Brown

Re: profile pictures do not work

by Christopher Phillips -
This is the third thread that I can find (one of them is mine) on this topic and as far as I can tell, none of them have been resolved-
I too get the:

The image “” cannot be displayed, because it contains errors.

message when I try to load the image in a browser. The other threads on this issue are at:

http://moodle.org/mod/forum/discuss.php?d=6903
and
http://moodle.org/mod/forum/discuss.php?d=6728


If anyone has any ideas additional ideas, they would be greatly appreciated!!

Christopher
Average of ratings: Useful (1)
In reply to Christopher Phillips

Re: profile pictures do not work

by Zbigniew Fiedorowicz -
The jpg begins with an extra newline character, which shouldn't be there. When I edit it out, the picture displays correctly. I think Martin's diagnosis in this thread is right on the money.  That newline is being copied from an extra newline at the end of your config.php.
In reply to Zbigniew Fiedorowicz

Re: profile pictures do not work

by Christopher Phillips -
That's interesting- is there anywhere else that an extra line could cause that same problem- I have checked my config file multiple times to make sure there was nothing after the ?> and notice that the other two experiencing this problem have indicated that they have done the same. Any ideas??
In reply to Christopher Phillips

Re: profile pictures do not work

by Zbigniew Fiedorowicz -
Here's a wild guess. Perhaps you editted your config.php on a Windows PC (or a Macintosh) and transferred it in binary mode (instead of ascii mode) to your server via ftp?

Also check the file 1/f1.jpg in your moodledata directory. Perhaps the extra newline is already present in that file?

Also Marc seems to have resolved his problem. Perhaps you should write him?

PS. The problem is definitely with your config.php.  I just tried the url:
http://www.communityinclusion.org/learning/moodle/config.php
and I get a newline in response. That URL should not return any content whatever.
In reply to Zbigniew Fiedorowicz

Re: profile pictures do not work

by Zbigniew Fiedorowicz -
Since it requires some specialized tools to detect newlines and invisible characters emitted by a malconfigured config.php file, I've created a simple web interface to these tools on my web site. Here is the url: https://webwork.math.ohio-state.edu/configcheck.php
In reply to Zbigniew Fiedorowicz

Re: profile pictures do not work

by Christopher Phillips -
Zbigniew-
Wow, thanks for all of your help- much appreciated! I feel like I'm finally getting somewhere on this- I have edited the file on a Mac and at first used the Automatic upload using Fetch- and it had uploaded it as a binary file- so then I uploaded it as a text file and it didn't change things-
Your config.php tool was great and confirmed what you had said that the problem is in the config file- it stated that the hex coding of the extra extraneous characters are 0x0a
I looked around and and far as I can tell that stands for an LF end of line code-
I am using BBEdit to work with my file and have tried changing the line endings to DOS, Mac and Unix and that doesn't seem to make a difference-
Any ideas on how I can locate and delete that extra character in my file- I've made sure over and over that there is nothing after the ?> in my file- but there must be something there!

Thanks again for all of your help- (would it help if I removed my pasword info and sent you the file?)

Christopher
In reply to Christopher Phillips

Re: profile pictures do not work

by Zbigniew Fiedorowicz -
First check that there isn't a blank line at the top of your config.php file.

Now try uploading a file named test.php containing the following (empty) PHP code:
<?PHP
?>
into your moodle directory on the server. Then enter the url: http://www.communityinclusion.org/learning/moodle/test.php
into my configcheck page.  If you get any extraneous newline with that file, then there is something funky about your setup - the way you are transferring files or something with BBEdit.  Check with your system administrator or hosting provider.

If you don't get any extraneous characters, then on your Macintosh, delete the first half of your config.php (but leave the  <?PHP line) and upload that as test.php and repeat the experiment. Then try the same with deleting the bottom half (but leave the ?> line).  Keep repeating the experiment bisecting the PHP code in half every time until you narrow it down to (hopefully) a single line.
In reply to Zbigniew Fiedorowicz

Re: profile pictures do not work

by Christopher Phillips -
Wow- thanks again for all of your help- the empty test.php file had no extaneous lines, so I started halfing the code until I identified the offending piece of code:

{ // Do not edit
include_once("$CFG->dirroot/lib/setup.php");
}

on lines 157-159 of the default config-dist.php file

I tried replacing them with the same lines from an original unedited file, but it still gave me the same error- strange. Any idea what it might be in that snippet of code that might causea an extraneous line?

Thank so much-
In reply to Christopher Phillips

Re: profile pictures do not work

by Zbigniew Fiedorowicz -
Here's the culprit:
http://www.communityinclusion.org/learning/moodle/theme/christopher/config.php
You must have a blank line at the top or bottom of that file.
In reply to Zbigniew Fiedorowicz

Re: profile pictures do not work

by Don Hinkelman -
Picture of Particularly helpful Moodlers Picture of Plugin developers
I'm confused now.  Martin and others have always said "no blank lines" at the end or beginning.  mixed
In reply to Don Hinkelman

Re: profile pictures do not work

by Zbigniew Fiedorowicz -
You are confused.smile My meaning was that the cause of Christopher's problems must be either (a) a blank line at top of that file or (b) a blank line at the bottom of that file.
In reply to Zbigniew Fiedorowicz

Re: profile pictures do not work

by Christopher Phillips -
Thanks again- I'm realizing that the problem is with the config.php file, but there is no blank line either before the beginning or after the end of the file.

However, when I take this snippet of code (on lines 157-159) out of the code:

{ // Do not edit
include_once("$CFG->dirroot/lib/setup.php");
}

then the extraneous blak line is gone. However, I realize that I cannot arbitrarily remove pieces of code. I can't see anything wrong with that code- and have recopied into the file from and original distribution, so I'm wondering if it could be something with the include setup.php (or inside the setup.php)- could that cause it to happen?

Thanks

In reply to Christopher Phillips

Re: profile pictures do not work

by Zbigniew Fiedorowicz -
Please reread my message.  I am referring to a different config.php
In reply to Zbigniew Fiedorowicz

Re: profile pictures do not work

by Christopher Phillips -
blush Woops- sorry about that, I re-read your message and sure enough- that was it! Thank you soooo much for all of you help, now I'll go and check with others who were having this problem- Thanks again!!!
In reply to Christopher Phillips

Re: profile pictures do not work

by W Page -
Hi!

Suggest
  • you get a completely fresh "config-dist.php" file and just open it in a basic (simple) type of editor like notpad for a Mac.
  • make the necessary path and database changes
  • save as "config.php"
  • upload in "ASCII" mode via FTP (whatever program it is for Mac)
OR
  • just do a complete install with new database.
  • open "config-dist.php" file in a basic (simple) type of editor.
  • upload file renamed "config.php" via FTP.

Sometimes you just have to start over to get things going. Cutting and pasting or doing a lot of corrections in a problem file can cause more or other problems. Also, some of the fancier editors add things you cannot see to files.

WP1