Can't display images when transfering!

Can't display images when transfering!

by Xariklia-Diana Bouraimi -
Number of replies: 12

Hi to all the community!

I have problem after migrating my database to another computer.I ran Moodle in a non productive server, so the settings are for localhost etc. But when we try to migrate the whole site to a productive server, changing  the settings the images uploaded in the lesson module via the facility of PowerPoint do not display. Maybe the path from the moodledata folder has change?

Please, any possible answer can help!   

Average of ratings: -
In reply to Xariklia-Diana Bouraimi

Re: Can't display images when transfering!

by Xariklia-Diana Bouraimi -

Hi again!

Am I too unclear? I am working hard to understand what has happened during the migration process, but we think it has something to do with the paths that the uploaded images are given? What I mean is that the images of the lesson don't display although their path includes the ../.../file.php/2/image01.jpg, the course root.Does anyone have the slightest idea what may go wrong?

Thank you in advance.

In reply to Xariklia-Diana Bouraimi

Re: Can't display images when transfering!

by Tony Hursh -
If you exported the database as SQL (rather than doing an individual course backup and restore) you'll need to also copy the data folder to the new server. If you backed up the course and restored the course as a zip file and told it to include course files, you shouldn't need to do this.

Are the images present in your new Moodle data folder under the correct course number? And are you sure that the course number in the image URL (2 in this case) corresponds to the course number where the files are actually located?

If you tell us how you performed the migration, it will be easier to tell you where to look.


In reply to Xariklia-Diana Bouraimi

Re: Can't display images when transfering!

by John Isner -
Also check the slasharguments setting on the Admin...->variables page. Your new server may not recognize paths like ../.../file.php/2/image01.jpg. As a simple experiment, try the other setting.
In reply to John Isner

Re: Can't display images when transfering!

by Xariklia-Diana Bouraimi -
First of all, thanks for the feedback!
I have checked the path and the slasharguments and seem ok. I have done the sql migration so as to create a totally new duplicate in a different server(something I was told to do so). Also the backup and restore of the course don't fix the problem. I should report again that the locations of the diractories moodledata, moodle,mysql have changed and also the settings for the password. I think that has something to do with the document root of the images, but I don't know what can be done or needs to de changed!?sad
In reply to Xariklia-Diana Bouraimi

Re: Can't display images when transfering!

by John Isner -
Did you change the value of $CFG->dataroot in config.php so that it points to your new moodledata directory? I'm only thinking of obvious things.
In reply to Xariklia-Diana Bouraimi

Re: Can't display images when transfering!

by Chris Collman -
Picture of Documentation writers

I had a similar problem on a couple of localhosts I was playing around with in the last two days. My images were replaced with their alternative text. There probably are much better solutions.

My solution: I noticed that when I took a backup from another Moodle and then did a restore of a course (deleted old and replaced an existing course) on my troublesome Moodle, Moodle got the right path and there were the images. That was taking a 1.54 backup and restoring it on a 1.63 and on a 1.7x Moodle, but I suspect it worked because each moodle was at a different location.

How I created the problem: I changed my Moodle\config.php file from the $CFG->wwwroot = localhost = a fix IP assigned to a computer. I also changed the Apache\config\httpd.conf file around line 170 that said ServerName localhost:80 to the fixed IP:80. What did not work was all my pictures in my lessons still pointed to http://localhost/file.php/4/Images_Prevention_and_Recognition/img0. jpg
instead of showing the fixed IP in something like http: //123.45.12.3/.... I would just see the alternative text, no image. All the file were in the right place.

It did not work when I backup up the course on the same Moodle and then tried the restore trick. I tried changing the moodle/config.php $CFG->dbhost = 'localhost'; to a fixed IP but it did not like that at all smile

Chris






In reply to Chris Collman

Re: Can't display images when transfering!

by Xariklia-Diana Bouraimi -
Thanks again for the trouble thinking over my problem.
I have changed all the settings in my Moodle\config.php file, yet it doesn't display the images.All the rest seem to work fine.In the beginning I thought their directories names were wrong , because I have translated them into Greek(in order to have Greek lesson names), but I fixed their names and their paths.
As it is mentioned, for security reasons, the moodledata directory was not transferred in the same location in the new server. I cannot think what goes wrong!If it doesn't work, it's like an end to an effort of months.
Can the permissions be wrong? ex.the .htaccess file in the moodledata directory has the "deny from all" statement. Is there any need for changes somewhere else?

Many, many thanks.
In reply to Xariklia-Diana Bouraimi

Re: Can't display images when transfering!

by John Isner -
The directory should have permission 777 or maybe 755 so that apache can write to it. Do you know how to change permissions?
In reply to John Isner

Re: Can't display images when transfering!

by Xariklia-Diana Bouraimi -
Do you mean change it in the config.php file or in the database or create the directory so as to run Apache with permissions?Sorry, but I am confused with the non-working result and disappointed. Anything that could help is welcome,even if I tried it please give me your opinion, in case of my mistake. Something I haven't set right causes the malfunction,I'm still in search.

In reply to Xariklia-Diana Bouraimi

Re: Can't display images when transfering!

by John Isner -
You need to change the permissions on the directory itself. You haven't told us what kind of server it is or what kind of access you have, so I can't tell you exactly how to do it, but it's trivial. If it's a shared Web hosting arrangement, you can use your Web host's Control Panel to change the permissions on the file so that everybody can read, write, execute. Or call their help desk and ask them to do it for you. If it's a Unix server and you have shell access, chmod 777 on the directory. If what I'm saying doesn't make sense, you need to find someone who understands how to change the permissions on a directory (also known as "folder") and ask them to do it.
In reply to Xariklia-Diana Bouraimi

Re: Can't display images when transfering!

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators
> In the beginning I thought their directories names were wrong , because I have translated them into Greek(in order to have Greek lesson names), but I fixed their names and their paths.

I am really surprised that you translated the directories names into Greek. This has nothing to do with the names of your lessons. Maybe that is the source of your problems.

Joseph

In reply to Joseph Rézeau

Re: Can't display images when transfering!

by Xariklia-Diana Bouraimi -
What I did was to give a greek name for every lesson I created and when I uploaded images of .ppt files (not in questions pages but in branch tables) the folder created in the moodledata directory was in Greek too! As a result this folder was not readable in other servers. So their names needed to be changed, and I did it manually and replace the new path in the images. Was this process wrong?If you need more about what I have done, I would surely give any information but I don't want to bother you with unnecessary details or alienate you from the possible causes of this problem.Please enlighten me.Thanks.