Images (journal logo, homepage,footer etc) not displaying in OJS 3.3.0-10

Description of issue or problem I’m having: When we upload the journal logo, homepage image,journal thumbnail, add image in footer or in custom block in sidebar, or even when admin user adds its profile image, it is uploaded without indicating an error and corresponding image is uploaded in respective files directory; however, it is not displayed. only a tiny image icon along with alternate text is displayed (see attached screenshots). The page source shows it as:

											<a href="						https://sub_domain.main_domain.com/index.php/journal/index
					" class="is_img">
							<img src="https://sub_domain.main_domain.com/public/journals/2/pageHeaderLogoImage_en_US.png" width="400" height="150" alt="journal logo" />
						</a>
								

or

<div class="homepage_image">
			<img src="https://sub_domain.main_domain.com/public/journals/2/homepageImage_en_US.jpg" alt="homepage image">
		</div>

I have checked the the config.inc.php file and the files settings are as:

files_dir = /home/hostusername/articlesfiles
public_files_dir = public
public_user_dir_size = 5000
umask = 0022
filename_revision_match = 70

And in general settings the baseURL is as: (OJS installation on subdomain):

base_url = "https://sub_domain.main_domain.com"

The permissions setting for public folder is 744 while all other permissions are as default when installed.
Steps I took leading up to the issue: I followed the recommended steps in PKP OJS docs for journal and website settings while logged in as admin user. Briefly:

  1. Uploaded the Logo at HostedJournal>settings>website>appearance>setup>logo
  2. Uploaded the Journal thumbnail at HostedJournal>settings>website>appearance>setup>journal thumbnail
  3. similarly for other images…

Note: On localhost with similar setting there is such problem when I upload the images.

What I tried to resolve the issue: Tried to search the forum for similar issues and either posts were related to outdated versions or some suggestions were to check the file settings such as public_files_dir = public for typos, but I found no typo and not changed anything regarding it.

Application Version: OJS 3.3.0-10

Additional information, such as screenshots and error log messages if applicable:
frontend_images_problem
backend_images_problem1
backend_images_problem2

Hi @cheema,

Did you try clearing caches (under the admin settings) to see if that might change anything?

-Roger
PKP Team

Thanks @rcgillis ,

I cleared both Clear Data Caches and Clear Template Cache under the admin settings as you suggested, but there is no change, the problem persists.

Do I need to check something else? i don’t know where I am making a mistake.

Sincerely
Cheema

Hi @cheema,

As a next step you could check your PHP Error logs to see if there is an indication of any errors there.

-Roger
PKP Team

thanks @rcgillis !

following are the error logs:

[16-Mar-2022 17:43:03 UTC] Server host "www.sub_domain.main_domain.com not allowed!
[16-Mar-2022 17:43:03 UTC] ojs2: 400 Bad Request
[17-Mar-2022 06:18:17 UTC] PHP Deprecated: Non-static method Core::_getBaseUrlAndPath() should not be called statically in /home/hostusername/public_html/sub_domain/lib/pkp/classes/core/Core.inc.php on line 231
[17-Mar-2022 06:18:17 UTC] PHP Deprecated: Non-static method Core::_getBaseUrlAndPath() should not be called statically in /home/hostusername/public_html/sub_domain/lib/pkp/classes/core/Core.inc.php on line 231
[17-Mar-2022 06:18:17 UTC] PHP Deprecated: Non-static method Core::_getBaseUrlAndPath() should not be called statically in /home/hostusername/public_html/sub_domain/lib/pkp/classes/core/Core.inc.php on line 231
[17-Mar-2022 06:18:17 UTC] PHP Deprecated: Non-static method Core::_getBaseUrlAndPath() should not be called statically in /home/hostusername/public_html/sub_domain/lib/pkp/classes/core/Core.inc.php on line 231
[17-Mar-2022 06:18:17 UTC] PHP Deprecated: Non-static method Core::_getBaseUrlAndPath() should not be called statically in /home/hostusername/public_html/sub_domain/lib/pkp/classes/core/Core.inc.php on line 231
[17-Mar-2022 06:18:17 UTC] PHP Deprecated: Non-static method Core::_getBaseUrlAndPath() should not be called statically in /home/hostusername/public_html/sub_domain/lib/pkp/classes/core/Core.inc.php on line 231
[17-Mar-2022 06:18:17 UTC] PHP Deprecated: Non-static method Core::_getBaseUrlAndPath() should not be called statically in /home/hostusername/public_html/sub_domain/lib/pkp/classes/core/Core.inc.php on line 231
[17-Mar-2022 06:18:17 UTC] PHP Deprecated: Non-static method Core::_getBaseUrlAndPath() should not be called statically in /home/hostusername/public_html/sub_domain/lib/pkp/classes/core/Core.inc.php on line 231
[17-Mar-2022 06:18:17 UTC] PHP Deprecated: Non-static method Core::_getBaseUrlAndPath() should not be called statically in /home/hostusername/public_html/sub_domain/lib/pkp/classes/core/Core.inc.php on line 231
[17-Mar-2022 06:18:17 UTC] PHP Deprecated: Non-static method Core::_getBaseUrlAndPath() should not be called statically in /home/hostusername/public_html/sub_domain/lib/pkp/classes/core/Core.inc.php on line 231
[17-Mar-2022 06:18:17 UTC] PHP Deprecated: Non-static method Core::_getBaseUrlAndPath() should not be called statically in /home/hostusername/public_html/sub_domain/lib/pkp/classes/core/Core.inc.php on line 231
[17-Mar-2022 06:18:17 UTC] PHP Deprecated: Non-static method Core::_getBaseUrlAndPath() should not be called statically in /home/hostusername/public_html/sub_domain/lib/pkp/classes/core/Core.inc.php on line 231
[17-Mar-2022 06:18:17 UTC] PHP Deprecated: Non-static method Core::_getBaseUrlAndPath() should not be called statically in /home/hostusername/public_html/sub_domain/lib/pkp/classes/core/Core.inc.php on line 231
[17-Mar-2022 06:18:17 UTC] PHP Deprecated: Non-static method Core::_getBaseUrlAndPath() should not be called statically in /home/hostusername/public_html/sub_domain/lib/pkp/classes/core/Core.inc.php on line 231
[17-Mar-2022 06:18:17 UTC] PHP Deprecated: Non-static method Core::_getBaseUrlAndPath() should not be called statically in /home/hostusername/public_html/sub_domain/lib/pkp/classes/core/Core.inc.php on line 231
[17-Mar-2022 06:18:17 UTC] PHP Deprecated: Non-static method Core::_getBaseUrlAndPath() should not be called statically in /home/hostusername/public_html/sub_domain/lib/pkp/classes/core/Core.inc.php on line 231

I don’t have any idea if these are related to this or not? but these are roughly about the time I tried to clear the caches

any more tests? checks?

Sincerely,
Cheema

Hi @rcgillis ,

I found the trick; however I am not sure if it is really the best way (what is the best permission level for public_files_dir = public?

Solution: the images started to display as expected when I changed the permissions of public folder in OJS installation directory back to 755.

Actually during installation I changed the permissions of public folder to 744 as recommended for security reasons in one of the video tutorials included in playlist of PKP youtube channel at https://www.youtube.com/user/PublicKnowledgeProj/playlists. The exact video I am talking about is 001 Step by Step Guide OJS 3.1 Installation with Linux Server and CWP Control Panel in Hindi - YouTube (see at timeline 8:15).

So I would like to know if I should keep permission levels to 744 and find another solution for images problem or the correct solution is to have permission level of 755 and its not a security concern?

Sincerely,
Cheema

Hi @cheema
the public directory can have 755 permissions (rwxr-xr-x) which normally in some hostings with Unix, the group is shared with the account that runs the webserver. Permissions to execute in a directory, basically it is to be able to change and see that directory. Note: only view the contents of the directory (x permissions) and not write or make changes (w permissions)

And probably your problem is that you are not giving read or execute permissions to the public directory.

Thanks @dagosalas

you are right, the problem was when I disabled the permissions to execute (rwxr–r–) i.e. 744. However, enabling execution permissions (rwxr-xr-x) i.e. 755 solved the problem.

Thanks everyone!
Sincerely,
cheema

1 Like