You are viewing the PKP Support Forum | PKP Home Wiki

Image can not be uploaded

Are you responsible for making OJS work -- installing, upgrading, migrating or troubleshooting? Do you think you've found a bug? Post in this forum.

Moderators: jmacgreg, btbell, michael, bdgregg, barbarah, asmecher

Forum rules
The Public Knowledge Project Support Forum is moving to http://forum.pkp.sfu.ca

This forum will be maintained permanently as an archived historical resource, but all new questions should be added to the new forum. Questions will no longer be monitored on this old forum after March 30, 2015.

Image can not be uploaded

Postby msaghaei » Fri Jan 13, 2006 12:37 am

In step 5 of journal setup (Journal Look), every effort at uploading graphic files (for tilte, home page, logo, etc) causes the invalid graphic format error. Upload directory (files) is writable.
Version: OJS 2.02-1
DB: mysql

Any advice will be appreciated
Posts: 119
Joined: Sun Jan 08, 2006 1:01 pm

Postby asmecher » Fri Jan 13, 2006 12:13 pm

Hello msaghaei,

There are two possible causes for this:
  • The public files directory can't be written by the webserver. Check to ensure that all files and subdirectories can be written by the webserver. (The public files directory is configured in OJS's config.inc.php file.)
  • PHP's mime_content_type function (see http://ca.php.net/manual/en/function.mime-content-type.php) isn't working or isn't configured properly. Try creating a test PHP script and ensure this is behaving as expected.
Alec Smecher
Open Journal Systems Team
Posts: 10015
Joined: Wed Aug 10, 2005 12:56 pm

How to configure PHP's mime_content_type function

Postby msaghaei » Sat Jan 14, 2006 2:40 am

Hi, Alec

Thank you for your reply
I used the following script
Code: Select all
echo mime_content_type('mui.jpg')  . "\n";
echo mime_content_type('mui.gif')  . "\n";
echo mime_content_type('mui.png') ;

and I noticed that my PHP's mime_content_type function return 'text/plain' for jpg, gif, png.. file extensions
I examined the content of 'magic.mime' file in three different locations. I did not find anything wrong within these files (all mentioned extensions were attributed correctly). For example for gif files I saw the following:
0 string GIF image/gif
On the otherhand the only occurence for the 'text/plain' was as follow:
0 string ;; text/plain 8bit
I can not imagined how this problem may be resolved. Please help me.

M. Saghaei
Posts: 119
Joined: Sun Jan 08, 2006 1:01 pm

A solution found

Postby msaghaei » Sat Jan 14, 2006 5:30 am

Dear Alec

I added the following directives to php.ini (picked it from http://ca.php.net/manual/en/function.mime-content-type.php):
Code: Select all
mime_magic.debug = On
mime_magic.magicfile = "c:\php\extras\magic.mime"

together with
Code: Select all
mime_magic.magicfile = path to magic.mime (e.g. /usr/lib/magic.mime)

After restarting linux, this worked. Thank you very much

M. Saghaei
Posts: 119
Joined: Sun Jan 08, 2006 1:01 pm

Return to OJS Technical Support

Who is online

Users browsing this forum: Bing [Bot] and 4 guests