WordPress.org

Ready to get started?Download WordPress

Forums

EWWW Image Optimizer
[resolved] Can't find images due to duplicated path (13 posts)

  1. mugwumpr
    Member
    Posted 1 year ago #

    Hello,

    It appears that somewhere along the way, EWWW is duplicating parts of the path to the images, which is leading to a "file not found" error. I'm using the optimizer on three other sites, on the same host, without problems. However, this one isn't working quite as I've come to expect.

    I'm using the latest version of EWWW Optimizer (installed about an hour ago) on the latest version of WordPress (installed 3 days ago).

    Images are not in year/month folders, just all in the "wp-content/uploads" folder.

    The following is the debug information generated by an attempt at bulk optimization:

    ewww_image_optimizer_resize_from_meta_data()
    meta file path: /templates/thelapine/wp-content/uploads/pandagay.jpg
    generated absolute path: /home/mugwumpr/public_html/snapdragonenterprises/templates/thelapine/wp-content/uploads//templates/thelapine/wp-content/uploads/pandagay.jpg
    ewww_image_optimizer()
    ewww_image_optimizer_tool_found()
    /usr/bin/nice: sh: /usr/bin/nice: No such file or directory
    ewww_image_optimizer_tool_found()
    nice: 15
    permissions: 0, owner: root, group: root
    file doesn't appear to exist
    processing resizes
    ewww_image_optimizer()
    ewww_image_optimizer_tool_found()
    /usr/bin/nice: sh: /usr/bin/nice: No such file or directory
    ewww_image_optimizer_tool_found()
    nice: 15
    permissions: 0, owner: root, group: root
    file doesn't appear to exist

    http://wordpress.org/extend/plugins/ewww-image-optimizer/

  2. nosilver4u
    Member
    Plugin Author

    Posted 1 year ago #

    It appears to be a permissions issue. From what the plugin can tell, your photos are owned by the root user (and root group), and it is highly unlikely that your webserver is running as the root user, so EWWW IO can't modify (optimize) the images. If you look at the debug info on the settings page, it should tell you what the web user is. Usually www-data on debian-derived systems or httpd on red hat derived systems.

  3. mugwumpr
    Member
    Posted 1 year ago #

    I checked the settings debug info and there doesn't seem to be either of those options. Here's what it shows (with a few minor edits):

    ewww_image_optimizer_notice_utils()
    ewww_image_optimizer_install_tools()
    Checking/Installing tools in [...]/thelapine/wp-content/ewww/
    wp-content/ewww permissions: 0755
    ewww_image_optimizer_install_paths()
    generated paths:
    [...]/thelapine/wp-content/plugins/ewww-image-optimizer/jpegtran-linux64
    [...]/thelapine/wp-content/plugins/ewww-image-optimizer/optipng-linux
    [...]/thelapine/wp-content/plugins/ewww-image-optimizer/gifsicle-linux
    [...]/thelapine/wp-content/ewww/jpegtran
    [...]/thelapine/wp-content/ewww/optipng
    [...]/thelapine/wp-content/ewww/gifsicle
    64-bit linux detected while installing tools
    ewww_image_optimizer_md5check()
    [...]/thelapine/wp-content/ewww/jpegtran-custom: 2dab67e5f223b70c43b2fef355b39d3f
    Linux/UNIX style OS, checking permissions
    jpegtran permissions: 0755
    gifislce permissions: 0755
    optipng permissions: 0755
    ewww_image_optimizer_path_check()
    found [...]/thelapine/wp-content/ewww/jpegtran, testing...
    ewww_image_optimizer_md5check()
    [...]/thelapine/wp-content/ewww/jpegtran: 4da4092708650ceb79df19d528e7956b
    ewww_image_optimizer_mimetype()
    testing mimetype: [...]/thelapine/wp-content/ewww/jpegtran
    mime_content_type: text/plain
    ewww_image_optimizer_tool_found()
    /usr/bin/file: magic file from /etc/magic:/usr/share/misc/magic
    file command: [...]/thelapine/wp-content/ewww/jpegtran: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, not stripped
    ewww_image_optimizer_tool_found()
    [...]/thelapine/wp-content/ewww/jpegtran: Independent JPEG Group's JPEGTRAN, version 9 13-Jan-2013
    found [...]/thelapine/wp-content/ewww/optipng, testing...
    ewww_image_optimizer_md5check()
    [...]/thelapine/wp-content/ewww/optipng: 4eb91937291ce5038d0c68f5f2edbcfd
    ewww_image_optimizer_mimetype()
    testing mimetype: [...]/thelapine/wp-content/ewww/optipng
    mime_content_type: text/plain
    ewww_image_optimizer_tool_found()
    /usr/bin/file: magic file from /etc/magic:/usr/share/misc/magic
    file command: [...]/thelapine/wp-content/ewww/optipng: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), statically linked, for GNU/Linux 2.6.9, not stripped
    ewww_image_optimizer_tool_found()
    [...]/thelapine/wp-content/ewww/optipng: OptiPNG version 0.7.4
    found [...]/thelapine/wp-content/ewww/gifsicle, testing...
    ewww_image_optimizer_md5check()
    [...]/thelapine/wp-content/ewww/gifsicle: 44273fad7b3fd1145bfcf35189648f66
    ewww_image_optimizer_mimetype()
    testing mimetype: [...]/thelapine/wp-content/ewww/gifsicle
    mime_content_type: text/plain
    ewww_image_optimizer_tool_found()
    /usr/bin/file: magic file from /etc/magic:/usr/share/misc/magic
    file command: [...]/thelapine/wp-content/ewww/gifsicle: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), statically linked, for GNU/Linux 2.6.9, not stripped
    ewww_image_optimizer_tool_found()
    [...]/thelapine/wp-content/ewww/gifsicle: LCDF Gifsicle 1.70
    ewww_image_optimizer_tool_found()
    pngout-static: sh: pngout-static: command not found
    ewww_image_optimizer_tool_found()
    pngout: sh: pngout: command not found
    ewww_image_optimizer_tool_found()
    /usr/bin/pngout-static: sh: /usr/bin/pngout-static: No such file or directory
    ewww_image_optimizer_tool_found()
    /usr/bin/pngout: sh: /usr/bin/pngout: No such file or directory
    ewww_image_optimizer_tool_found()
    /usr/local/bin/pngout-static: sh: /usr/local/bin/pngout-static: No such file or directory
    ewww_image_optimizer_tool_found()
    /usr/local/bin/pngout: sh: /usr/local/bin/pngout: No such file or directory
    using: [...]/thelapine/wp-content/ewww/jpegtran
    using: [...]/thelapine/wp-content/ewww/optipng
    using: [...]/thelapine/wp-content/ewww/gifsicle
    ewww_image_optimizer_options()
    ewww_image_optimizer_install_paths()
    generated paths:
    [...]/thelapine/wp-content/plugins/ewww-image-optimizer/jpegtran-linux64
    [...]/thelapine/wp-content/plugins/ewww-image-optimizer/optipng-linux
    [...]/thelapine/wp-content/plugins/ewww-image-optimizer/gifsicle-linux
    [...]/thelapine/wp-content/ewww/jpegtran
    [...]/thelapine/wp-content/ewww/optipng
    [...]/thelapine/wp-content/ewww/gifsicle
    ewww_image_optimizer_tool_found()
    [...]/thelapine/wp-content/ewww/jpegtran: Independent JPEG Group's JPEGTRAN, version 9 13-Jan-2013
    ewww_image_optimizer_tool_found()
    [...]/thelapine/wp-content/ewww/optipng: OptiPNG version 0.7.4
    ewww_image_optimizer_tool_found()
    [...]/thelapine/wp-content/ewww/gifsicle: LCDF Gifsicle 1.70
    ewww_image_optimizer_gd_support()
    GD found, supports:
    GD Version: bundled (2.0.34 compatible)
    FreeType Support: 1
    FreeType Linkage: with freetype
    T1Lib Support:
    GIF Read Support: 1
    GIF Create Support: 1
    JPG Support: 1
    PNG Support: 1
    WBMP Support: 1
    XPM Support: 1
    XBM Support: 1
    JIS-mapped Japanese Font Support:
    ewww_image_optimizer_tool_found()
    convert: Version: ImageMagick 6.7.6-8 2012-05-02 Q16 http://www.imagemagick.org
    disabled functions: dl
    ewww_image_optimizer_tool_found()
    /usr/bin/file: magic file from /etc/magic:/usr/share/misc/magic
    ewww_image_optimizer_tool_found()
    /usr/bin/nice: sh: /usr/bin/nice: No such file or directory
    ewww_image_optimizer_tool_found()
    nice: 15
    ewww_image_optimizer_tool_found()
    tar: tar (GNU tar) 1.23
    ewww_image_optimizer_jpeg_background()
    ewww_image_optimizer_jpeg_background()
    ewww_image_optimizer_jpg_quality()

    The permissions on the images that work, and the ones that don't, are all 0644. Not sure how to change the user, though, sorry.

    Would the owner issue explain why it's iterating the absolute path twice when it tries to optimize?

    [...]/templates/thelapine/wp-content/uploads//templates/thelapine/wp-content/uploads/pandagay.jpg

  4. nosilver4u
    Member
    Plugin Author

    Posted 1 year ago #

    Do you know how to look at the ownership info for a file? If you tell me what you are using to check the permissions, I can try to help you figure out where to change ownership.

    And the answer to your question is YES, here's why:

    The plugin first tries to verify the path stored in the database without modifying anything (which is generally only valid for older images). If that succeeds, great, we keep going with the optimization. Otherwise, the plugin prepends the location of the uploads folder to the path, and tries again. In your case, since the owner is set to root, it fails both time, and we get a file not found error.

    And FYI, the very first line of the debug info should be the user that runs the webserver process.

  5. mugwumpr
    Member
    Posted 1 year ago #

    No, I'm afraid I don't know. I'm using the File Manager through CPanel.

    The very first line of the debug info for both the non-working installation and the working installation are the same. Neither are the owners of the respective blogs. (i.e. "root" is what shows for both, but the admin for Blog 1 is "blog1" and the admin for Blog 2 is "blog2".)

    Is any of that useful?

  6. nosilver4u
    Member
    Plugin Author

    Posted 1 year ago #

    Is 'root' what it actually shows? If that is the case, it 'should' be working. The user account for the web server is totally separate from your WordPress user accounts, but generally your web server doesn't run as 'root' either, so that is a little surprising.
    I checked the file manager with my cpanel, and I don't see any place to even view the current owner, much less change it.

    Is it possible that the files in question are actually missing?

  7. mugwumpr
    Member
    Posted 1 year ago #

    It doesn't actually say "root", but the user shown in both cases is the root user for the overall account. It's the username I use to sign into the CPanel and everything else administrative.

    The files are there, exactly as they should be. I checked both the file manager, and even the database for the relevant posts & attachment pages, and both show the correct path. In fact the path shown in EWWW is correct, just doubled.

    Tacking the image path onto the end of the blog URL brings up the image as expected.

  8. nosilver4u
    Member
    Plugin Author

    Posted 1 year ago #

    That's a very important piece of information. There is only ONE root user on a server, and it is actually named 'root', all the time. So if the user account you are seeing in the debug is different (and it should be), that is the user that needs to own the files. Check with your webhosting company, and see if they can help you figure out a way to change the ownership on those files to match the username that you use for cpanel (the one you see at the top of the debug info). If you're on a typical webhost, EVERY file in your public_html folder should be owned by this user. If you have shell access, you can run this command:

    chown -R put_your_username_here /home/mugwumpr/public_html/

  9. mugwumpr
    Member
    Posted 1 year ago #

    I checked with my webhost about changing the ownership of the files, and, after checking my entire account, they replied, "I am not seeing any files that are not owned by you in the directory you mentioned." Followed by a comprehensive list of files not owned by me, none of which were at all related to that particular WordPress installation.

    Would the fact that it's a sub-subdirectory of another WordPress installation have something to do with the problem?

  10. nosilver4u
    Member
    Plugin Author

    Posted 1 year ago #

    I think you're closer to the mark with that. I didn't look close enough at the original debug, but here's what it looks like to me (not sure how to fix it though):

    The first few lines tell what is happening. the partial path stored in the database is this: /templates/thelapine/wp-content/uploads/pandagay.jpg

    That should be relative to the uploads/ folder:
    /home/mugwumpr/public_html/snapdragonenterprises/templates/thelapine/wp-content/uploads/

    But... it's not. You put those together, and you get the path that is generated in the debug info. It almost looks like that particular image was uploaded when your wordpress install was in another location, but I don't know the history of your wordpress site, so all I can do is guess as to how that happened. If you click on View for that image in the Media Library, it should give you a 404 or a broken link, since I don't know that WordPress would be able to find the file either. If it can, I'd like to know how, so I can improve the path-generating code in the plugin.

  11. mugwumpr
    Member
    Posted 1 year ago #

    The content of this website was imported during a conversion from Drupal.

    I tried the View and Edit image and every other way I could think of to access it, and all the content during testing, and they all work as expected, except for EWWW.

    Within the next week or so the website will be moving to its permanent home, replacing the old Drupal version, so I'll let you know what happens once it's not buried a few levels deep in another website. Hopefully that'll solve the problem.

  12. nosilver4u
    Member
    Plugin Author

    Posted 1 year ago #

    Ah, that could be part of the issue. Let me know how it works out.
    In the meantime, I did find a function in wordpress core that could be very useful in finding paths, but it may be a while before I have more time to work on that.

  13. mugwumpr
    Member
    Posted 1 year ago #

    I solved the problem with a brute force "big stick" approach. I deleted all the images, then re-uploaded them, and EWWW is now seeing them as expected. I have no idea what was going on with them, but it was weirder than I'm comfortable with, that's for sure!

    Thank you for all your help.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.