Can't see images

Can't see images

by Marco Rota -
Number of replies: 32

Hi all,

I don't know why but I can't see images stored in my moodledata folder.

I see list of my files but if I click on them It seems the server can't find them. It don't display images.

Help me please. Tnx

Average of ratings: -
In reply to Marco Rota

Re: Can't see images

by Michael Goncharenko -
hi.

It don't display images.

Okay. It does not display images. But what's displayed instead of them?
In reply to Michael Goncharenko

Re: Can't see images

by Marco Rota -

Thank you Michael for answer... I'm sorry for my bad english.

Instead of them I see only a border with a "x" at top left.

------------
|x         |
|          |
|          |
------------

It seems images are not found but in "Site files" they are listed!

In reply to Marco Rota

Re: Can't see images

by Michael Goncharenko -
What does error log say? Images are found, but I think they are displayed incorrectly. That happens sometimes when there are some empty lines at the beginning of the file.php file.
Try updating your Moodle to the latest version. (but BACKUP EVERYTHING before you try!!!)

P.S. By the way... Is your image file correct?
In reply to Michael Goncharenko

Re: Can't see images

by Marco Rota -

My images file are shurely correct because if I put them in the webroot I can see them by url directly. It seems my problem is the moodledata folder.

My file.php file have no empty lines at the beginning.

I'm using Moodle 1.8.2.

For error log.... do you refer to httpd/error.log?

Thank you for help me and for patience for my perfect english! big grin

In reply to Marco Rota

Re: Can't see images

by John Isner -
Please post the URL of one of your images. They should be publicly accessible because they're in site files.
In reply to John Isner

Re: Can't see images

by Marco Rota -

It's an internal site... anyway...

http://10.0.23.70/moodle/file.php?file=/1/spok.jpg

In reply to Marco Rota

Re: Can't see images

by Michael Goncharenko -
Right-click on this link, choose "Save target as...", save it as spok_bad_file.jpg.
Compare it with original spok.jpg.

Are you using linux, unix or windows? Apache or IIS?
In reply to Michael Goncharenko

Re: Can't see images

by Marco Rota -

mmmm.... .

Right-click on image link from FrontPage > Site Files.... Save object as...

Double-click on the "image" saved and.... "No preview available".

File spok.jpg (on the server) and spok_bad_file.jpg (on my desktop) have same dimension so I think they are equal. If repeat... If I directly link the moodledata/1/spok.jpg file I can see him.

What happen? surprise

PS: I'm using Linux (Fedora Core 7), Apache 2.

In reply to Marco Rota

Re: Can't see images

by Michael Goncharenko -
Double-click on the "image" saved and.... "No preview available".

That's it. file.php does not give your file to you correctly.

File spok.jpg (on the server) and spok_bad_file.jpg (on my desktop) have same dimension so I think they are equal.

Sorry, but what is dimension? Extension? File size? File type? They are not equal, I'm sure.
In reply to Michael Goncharenko

Re: Can't see images

by Marco Rota -

dimension = File Size. smile))))

I've tried to put the spok_bad_file.jpg "image" on the server but I can't see him directly with url.

So you have reason. The file.php does not give me the file correctly! But... Why?

In reply to Marco Rota

Re: Can't see images

by Michael Goncharenko -
Pack spok.jpg and spok_bad_file.jpg to zip-archive and send to this forum please. They really are different, we just have to see where.
In reply to Michael Goncharenko

Re: Can't see images

by Marco Rota -
Et voilà!
In reply to Marco Rota

Re: Can't see images

by Michael Goncharenko -
I was right. There's a newline at the very beginning of your JPG file. You may see it if you open these files in the notepad: first line must not be empty, but in spok_bad_file it is.
  1. Doesn't your file.php really have empty lines at the beginning?
  2. Also check config.php for newlines at the beginning.
  3. Also... I don't know, what files you should also check. But I think — all PHP files.Широкие глаза (backup before!!!)
If this won't work, you could give me an SSH account on your server. Once I have solved this problem. If you trust me, of course.

But — not exactly now, I'll be back in ~10 hours. Good night.
In reply to Michael Goncharenko

Re: Can't see images

by Marco Rota -

My file.php and config.php files don't have empty lines at the beginning.

file.php:

<?php // $Id: file.php,v 1.44.2.1 2007/04/02 16:12:26 skodak Exp $
      // This script fetches files from the dataroot directory
      // Syntax:      file.php/courseid/dir/dir/dir/filename.ext
      //              file.php/courseid/dir/dir/dir/filename.ext?forcedownload=1
 (download instead of inline)
      //              file.php/courseid/dir (returns index.html from dir)
      // Workaround:  file.php?file=/courseid/dir/dir/dir/filename.ext
      // Test:        file.php/testslasharguments
      //TODO: Blog attachments do not have access control implemented - anybody
can read them!
      //      It might be better to move the code to separate file because the a
ccess
      //      control is quite complex - see bolg/index.php
    require_once('config.php');
    require_once('lib/filelib.php');

    if (empty($CFG->filelifetime)) {
        $lifetime = 86400;     // Seconds for files to remain in caches
    } else {
....
....
....

config.php:

<?php  /// Moodle Configuration File
unset($CFG);

$CFG->dbtype    = 'mysql';
$CFG->dbhost    = 'localhost';
$CFG->dbname    = 'moodle';
$CFG->dbuser    = 'muser';
$CFG->dbpass    = 'mpass';
$CFG->dbpersist =  false;
$CFG->prefix    = '';

$CFG->wwwroot   = 'http://10.0.23.70/moodle';
$CFG->dirroot   = '/var/www/html/moodle';
....
....

Thank you very much for support. I hope finally we can solve this problem.

see you soon... bye!

Ps. I can't give you an ssh access.

In reply to Marco Rota

Re: Can't see images

by Michael Goncharenko -
require_once('lib/filelib.php');
Check this file (lib/filelib.php) also for empty newlines at the beginning of the file.

Thank you very much for support. I hope finally we can solve this problem. see you soon... bye!
The problem's almost solved: we know the reason and that's ~98% of the whole tasksmile

Ps. I can't give you an ssh access.
We, humans, always look for a hard way to do simple things. ;)
In reply to Michael Goncharenko

Re: Can't see images

by Marco Rota -

         The problem's almost solved: we know the reason and that's ~98% of the whole tasksmile
I hope you have reason this time too.

           We, humans, always look for a hard way to do simple things. ;)
Absolutely! I'm sorry... I'm not the boss...

           Check this file (lib/filelib.php) also for empty newlines at the beginning of the file.
I'm away at the moment. I will check as soon as possible (tomorrow sad)...

Thank you again!

In reply to Marco Rota

Re: Can't see images

by Marco Rota -

Ok... i'm back!

... this is the top of my lib/filelib.php:

<?php //$Id: filelib.php,v 1.39.2.6 2007/08/23 06:42:24 moodler Exp $

require_once($CFG->libdir.'/libcurlemu/libcurlemu.inc.php'); // might be moved to setup.php later

define('BYTESERVING_BOUNDARY', 's1k2o3d4a5k6s7'); //unique string constant

I've checked libcurlemu/libcurlemu.inc.php also... no empty lines at the beginning.

In reply to Marco Rota

Re: Can't see images

by Michael Goncharenko -
Hi, Marco.

Listen, what about to talk to your boss about temporary ssh for me to fix this? That would really be easier than to guess, what file has empty line in it. I'm not a hacker, I don't need any passwords, courses, etc from your server, I only offer you my help. :-\
In reply to Michael Goncharenko

Re: Can't see images

by Marco Rota -

Thank you again Michael... but I can't...

If you are shure I have a file with empty line I will find it.

Are you shure there are no other ways? Couldn't be a gd problem?

In reply to Marco Rota

Re: Can't see images

by Michael Goncharenko -
Couldn't be a gd problem?

No. AFAIK, file.php doesn't use GD. It just reads the file you specified and prints it to the standard output (browser).
In reply to Michael Goncharenko

Re: Can't see images

by Marco Rota -

YEEEEEEEEEEEEAAAAAAAAAAAAHHHHHHHHHHH!!!!!!

I've found it!!! The empty line was in the end of config.php file!!!!!!

NOW I CAN SEE IMAGES!!!!!!

THANK YOU MICHAEL!!!!!!!!! YOU ARE MY JEDI MASTER!!!!!!

Now I've to understand what to do with my imported course with blank images... I hope to fix them re-restoring backups files!

THANK YOU!!!

In reply to Marco Rota

Re: Can't see images

by Marco Rota -

OK, now it's all rights except for user profiles images.

I can see them in user profile page but I can't see the small version in others pages like forums etc...

In reply to Marco Rota

Re: Can't see images

by Marco Rota -

mmm... interesting...

That's happen only with administrator profile image. surprise

In reply to Marco Rota

Re: Can't see images

by Michael Goncharenko -
okay... that's what would be good to do:
  1. Remove your user's (administrator's) picture.
  2. Upload there another picture.
  3. Check if it is displayed correctly. If not — I suspect another newline somewhere. Try downloading small user's image, open it in the notepad. Show it to someone and say: "that's how everyone should solve problems with Moodle". Make them be afraid of the man who examines JPEGs in the notepad. ЗлоОдобрить
In reply to Michael Goncharenko

Re: Can't see images

by Marco Rota -

mmm... I think this time is a bit different because I can see all user's images except small administrator's image (the big is ok in the profile page).

Anyway... I can't download small administrator's image because there isn't (blank), so I haven't the option to download it.

In reply to Marco Rota

Re: Can't see images

by Michael Goncharenko -
Anyway... I can't download small administrator's image because there isn't (blank), so I haven't the option to download it.

You can look into HTML page source, where the URL of the small picture is located.
In reply to Michael Goncharenko

Re: Can't see images

by Marco Rota -

Is that:

http://10.0.23.70/moodle/user/view.php?id=2&amp;course=1 .... userpicture = http://10.0.23.70/moodle/user/pix.php?file=/2/f2.jpg

If I go to http://10.0.23.70/moodle/user/pix.php?file=/2/f2.jpg I can't see the image but If I go directly to http://10.0.23.70/moodledata/users/2/f2.jpg I see the image.

This is a link to user's image with no problem: http://10.0.23.70/moodle/user/pix.php?file=/12/f2.jpg

So it seems to be the same...

Is it correct I have id=2 for administrator?

In reply to Marco Rota

Re: Can't see images

by Marco Rota -

Ok now it's all right!

Probabily it was only a cache problem...

Thank you again Michael!

Bye