Topic on Project:Support desk

I can't seem to figure out how to get images to work

13
68.110.86.107 (talkcontribs)

I'm migrating to a new server, and I've got the pages up and running. I moved the images to the new server and they all have the same file structure. I've given the folders 755 and files 644. Media wiki still can't seem to find the images.

Bawolff (talkcontribs)

ensure $wgUploadPath and $wgUploadDirectory is correct. Check that the webserver serves them, and on pages check the page source and that the img tags have the src attribute you expect them to.

Also check if its just on ordinary pages or if it is also image description pages.

68.110.86.107 (talkcontribs)

no luck.

I'm just using the default directories for the images and uploads, so those variables weren't even set on my prior server.

However, just to make sure I tried it correctly. the wiki is in a folder called wiki, but the domain hides that. so those variables should just be '/images'

The images aren't show on any of the pages, or on their description pages.

68.110.86.107 (talkcontribs)

Thanks,@Bawolff!

When I view the source I have something like this:

<a href="/index.php?title=File:Georgia-1822.jpg" class="mw-redirect" title="File:Georgia-1822.jpg">File:Georgia-1822.jpg</a>

So no path to really verify.

And on the description page, it just says "No file by this name exists, but you can upload it." So no path to inspect here either.

Bawolff (talkcontribs)

Can you verify in the database that the image table has a row with img_title set to "Georgia-1822.jpg" ?

Bawolff (talkcontribs)

i'd reccomend changing those settings back to default if they are not the issue (in particular /images is probably not the right value for manual:$wgUploadDirectory, but from your description the defaults sound right)

what happens if you go directly to the url of one of the images (e.g. if one of the images were in wiki/images/a/ab/image.jpg, what happens when you view mysite.com/images/a/ab/image.jpg ?)

68.110.86.107 (talkcontribs)

403 forbidden. So I'm guessing nginx is misconfigured somehow.

Bawolff (talkcontribs)

it might be that the permissions on the files themselves are wrong if you transferred between servers. Make sure the image directory (and files/subdirectories) are owned by the webserver and readable by it (using unix tools like chown and chmod)

68.110.86.107 (talkcontribs)

ok so if I go do domain/images/0/01/William_Edwards_%281817%29_Headstone.jpg I get the image. However if I go to domain/index.php?title=File:William_Edwards_(1817)_Headstone.jpg it shows "No file by this name exists, but you can upload it

Does that mean the mediawiki scripts cant read the directory?

68.110.86.107 (talkcontribs)

checkImages.php says

PHP Warning:  Use of undefined constant NS_IMAGE - assumed 'NS_IMAGE' (this will throw an Error in a future version of PHP) in /var/www/prod/wiki/LocalSettings.php on line 208

PHP Warning:  Use of undefined constant NS_IMAGE_TALK - assumed 'NS_IMAGE_TALK' (this will throw an Error in a future version of PHP) in /var/www/prod/wiki/LocalSettings.php on line 209

Good images: 0/0

68.110.86.107 (talkcontribs)

I fixed the php warning ....

still 0/0 good images

68.110.86.107 (talkcontribs)

ok I have successfully loaded a new image, and it displays just fine. it's saving in the same directory as all the other images. I've verify the same permissions on the new file as all the old ones.

It just seems as though mediawiki has decided the images don't exist so it's not even looking.

68.110.86.107 (talkcontribs)

ok not sure what I did, but messing around with the nginx config let me run the import images script.

That's lead me to some other things that need to be fixed, but at least it seems like the photos are recognized now.