Support » Plugin: Motivation Generator » File access error

  • Resolved TStone


    This plugin doesn’t work, and it seems it has to do with the usage of getimagesize in the code which (I think) is dependent on “allow_url_fopen” beeing enabled, and on many shared hostings it is disabled for security reasons.

    In the admin settings, it show two errors in red:
    “File wp-content/plugins/motivation-generator/fonts/FreeSerif.ttf not found.”
    “/wp-content/uploads/posters/ Can not be created. Please check your file permissions.”

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author stepan1010


    Hey, TStone. Sorry for the late answer 🙂

    If you see two errors in red in the admin settings, that’s most likely has to do with your file permissions. The first error (about the font) comes up if “file_exists” returns false and the second error comes up if “mkdir” returns false. It takes paths, not urls as arguments in both of these functions, so “allow_url_fopen” isn’t the case here.

    What’s interesting is the first error (about the font being not found). I use “plugin_dir_path” to determine the location of the plugin, so any custom names of “wp-content” shouldn’t be the problem either.

    Could you please make sure you are allowed to create files and folders on your hosting? In case you are, please try reinstalling the plugin by removing it completely and downloading it again from


    The file permissions are fine.

    Whether the file paths are correct or not does not change the fact that you have getimagesize in the code. Which often is disabled because it is a security risk since it can be used for code injections. Even if everything else were perfect, there is no way that this plugin can function when “allow_url_fopen” is disabled.

    For it to function, getimagesize need to be replaced with a cURL solution. There’s tons of examples on the net on how this is done. Two randomly chosen examples:

    If your server sets the allow_url_fopen and allow_url_include PHP directives OFF

    Plugin Author stepan1010


    Even if everything else were perfect, there is no way that this plugin can function when “allow_url_fopen” is disabled.

    That is true if (and only if) you pass a url as a parameter to getimagesize. All the examples you mentioned are talking about remote files, not the ones that are already on your server.

    Here is an example. The code below will work no matter what allow_url_fopen is set to:

    $arr = getimagesize("/var/www/testing/face.png");

    However, the following code will return false in case allow_url_fopen is disabled:

    $arr = getimagesize("");

    Well, you are probably right.
    Still, there is something that prevent your plugin from working, and it’s not file permissions.

    Plugin Author stepan1010


    Thanks for the screenshot! Turns out there was an error when default directories were set so the plugin was looking for files and folders in wrong places. I’ve just committed the changes which fix it.

    Please remove the plugin completely through “Settings” -> “Plugins” and install it again. Make sure that you are installing version 1.3.6.

    Now it works! 🙂

    Thank you!

    Plugin Author stepan1010


    Thank you for the feedback 🙂

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘File access error’ is closed to new replies.