WordPress.org

Forums

WP Smush
[resolved] Error: Could not find: strange path (3 posts)

  1. shortster
    Member
    Posted 4 years ago #

    When I create a post in the normal way and upload an image through the new post 'add an image' button everything goes fine. In the media-library I see the image is attached to the post and the image gets smushed.

    However if I upload an image through for example the commentbox (via a plugin) on the frontend of my website, the image gets uploaded to the media-library but the smush.it column says:
    "could not find /home/mysite/domains/mysite.com/public_html/wp-content/uploads/http://www.mysite.com/wp-content/uploads/2011/03/theimage.jpg"

    Note: the image is not attached to a post (unattached). Don't know if that's good or bad..

    Any idea what's wrong here?

  2. shortster
    Member
    Posted 4 years ago #

    Found the error. When manually adding an uploaded image to the media library, you use:
    wp_insert_attachment( $attachment, $filepath);
    and
    wp_generate_attachment_metadata( $attach_id, $filepath );
    Where $filepath needs to be the absolute path. I used the url. With the url in the metadata of the image WP Smush.it tried to locate the image at
    absolutepath + url = /home/mysite/domains/mysite.com/public_html/wp-content/uploads/http://www.mysite.com/wp-content/uploads/2011/03/theimage.jpg

    Hope it makes sense :)

  3. José Luís
    Member
    Posted 3 years ago #

    It makes sense. But how do we fix it? I'm not using a plugin, only WP Media Library upload function and this error keeps showing.

    Any news on this topic?

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WP Smush
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags