• Recently my team transferred a client’s website to a new host.

    After the transfer, I tried to optimize the images with several plugins; each image plugin produces the same error, which comes down to “Could not find 2018/05/imagename.jpg” and “The fullsize image file cannot be found in your uploads directory at 2017/06/blog-post-1.jpg”, and so on.

    Things to note:
    1. All images are working properly on the site and have the url of hostname.com/wp-content/uploads/2018/05/imagename.jpg, with the corresponding year/month of upload.
    2. Images newly uploaded produce the same error.
    3. An image that is newly resized with a new file created inside the WP Media Library does not generate this error.
    4. The majority of the image paths start with http: and only ones uploaded recently have https: ; however, this does not seem to have an effect on whether or not it will work, as noted in #2.

    I have already tried all of the following:
    1. Set permissions of folders to 755 and files to 644 via FTP, and double checked in cPanel to see if these were being reflected.
    2. Deleted a month’s image folder and uploaded a backup via cPanel.
    3. Gone into MySQL and set upload_path to wp-content/uploads (which was blank before I set the path)
    4. Gone into wp-config via FTP and added define( ‘UPLOADS’, ‘wp-content/uploads’ ); right after
    if ( !defined(‘ABSPATH’) ) define(‘ABSPATH’, dirname(__FILE__) . ‘/’);
    and before
    require_once(ABSPATH . ‘wp-settings.php’);
    which is at the bottom of the file.

    I have googled every iteration I could think of this problem and while the above solutions seemed to help others, they have not fixed my problem.

    If anyone has any idea on a possible solution I would be grateful.

    Thanks.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator bcworkz

    (@bcworkz)

    Please check you error logs for any related messaging that would tell us exactly what error occurred where. To debug a problem, it’s good to have a starting point.

    If your site is otherwise working, it may not be a good idea to “fix” it for the sake of some plugins. Is there some other way to optimize the images as you want without plugins? Or develop code that is capable if getting proper image references, then feeding the reference to the plugin’s optimization functions?

    Thread Starter suviu

    (@suviu)

    Hi @bcworkz,

    Thank you for replying. I enabled debugging in my config file and I found two plugins with deprecated PHP. Deactivating these, while getting rid of those errors, did not fix my actual problem.

    The debug.log only seems to have recorded the PHP errors. Here is what Google Console told me upon loading the page:

    Upon loading:

    (x6) XHR finished loading: POST "<URL>".
    (x118) Mixed Content: The page at '<URL>' was loaded over HTTPS, but requested an insecure image '<URL>'. This content should also be served over HTTPS.

    I used Console after trying to locate the file via the Regenerate Thumbnail plugin, but the output upon using this plugin is a ridiculous length so I won’t copy/paste it all here unless someone specifically asks for it.

    I would presume that the error lies somewhere within “Uncaught Error: Syntax error, unrecognized expression: #/regenerate/16212” or potentially within the image files being served as HTTP rather than over HTTPS, possibly.

    Upon using another popular plugin, Smush:

    Output:

    load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,utils,jquery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-draggable,moxiejs,plupload&ver=4.9.8:4 
    
    XHR finished loading: GET "https://www.ecdllc.net/wp-admin/admin-ajax.php?action=wp_smushit_manual&is_bulk_resmush=false&attachment_id=16212&get_next=0&_nonce=".

    And it told me that the file cannot be found.

    And finally, upon using another compressing tool, reSmushIt:

    Output:

    GET https://www.example.net/wp-admin/upload.php?page=resmushit_options net::ERR_INCOMPLETE_CHUNKED_ENCODING 200 (OK)
    ((I cut about 50 lines of load-script.php here))
    XHR failed loading: POST "https://www.example.net/wp-admin/admin-ajax.php".
     POST https://www.example.net/wp-admin/admin-ajax.php net::ERR_EMPTY_RESPONSE

    And finally, with a snippet of all the load-scripts.php?:

    Uncaught TypeError: Cannot read property 'hasClass' of undefined
        at HTMLDocument.<anonymous> (load-scripts.php?c=1&load[]=hoverIntent,common,admin-bar,jquery-ui-resizable,jquery-ui-button,jquery-ui-position,jquery-ui-dialog,svg-painter,heartbeat,wp-a&load[]=uth-check,jquery-ui-sortable,underscore,shortcode,backbone,wp-util,wp-backbone,media-models,wp-plupload,wp-mediaelement,wp-api-r&load[]=equest,media-views,media-editor,media-audiovideo,mce-view,imgareaselect,image-edit,media-grid,wp-api,thickbox,jquery-ui-droppabl&load[]=e,jquery-ui-tabs,jquery-effects-size,jquery-effects-scale,jquery-effects-highlight,jquery-effects-transfer&ver=4.9.8:290)
        at HTMLDocument.dispatch (load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,utils,jquery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-draggable,jquery-ui-slider,jquery-tou&load[]=ch-punch,iris,wp-color-picker,moxiejs,plupload&ver=4.9.8:3)
        at HTMLDocument.r.handle (load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,utils,jquery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-draggable,jquery-ui-slider,jquery-tou&load[]=ch-punch,iris,wp-color-picker,moxiejs,plupload&ver=4.9.8:3)
        at Object.trigger (load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,utils,jquery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-draggable,jquery-ui-slider,jquery-tou&load[]=ch-punch,iris,wp-color-picker,moxiejs,plupload&ver=4.9.8:3)
        at Object.a.event.trigger (load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,utils,jquery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-draggable,jquery-ui-slider,jquery-tou&load[]=ch-punch,iris,wp-color-picker,moxiejs,plupload&ver=4.9.8:9)
        at HTMLDocument.<anonymous> (load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,utils,jquery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-draggable,jquery-ui-slider,jquery-tou&load[]=ch-punch,iris,wp-color-picker,moxiejs,plupload&ver=4.9.8:3)
        at Function.each (load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,utils,jquery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-draggable,jquery-ui-slider,jquery-tou&load[]=ch-punch,iris,wp-color-picker,moxiejs,plupload&ver=4.9.8:2)
        at a.fn.init.each (load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,utils,jquery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-draggable,jquery-ui-slider,jquery-tou&load[]=ch-punch,iris,wp-color-picker,moxiejs,plupload&ver=4.9.8:2)
        at a.fn.init.trigger (load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,utils,jquery-ui-core,jquery-ui-widget,jquery-ui-mouse,jquery-ui-draggable,jquery-ui-slider,jquery-tou&load[]=ch-punch,iris,wp-color-picker,moxiejs,plupload&ver=4.9.8:3)
        at Object.<anonymous> (load-scripts.php?c=1&load[]=hoverIntent,common,admin-bar,jquery-ui-resizable,jquery-ui-button,jquery-ui-position,jquery-ui-dialog,svg-painter,heartbeat,wp-a&load[]=uth-check,jquery-ui-sortable,underscore,shortcode,backbone,wp-util,wp-backbone,media-models,wp-plupload,wp-mediaelement,wp-api-r&load[]=equest,media-views,media-editor,media-audiovideo,mce-view,imgareaselect,image-edit,media-grid,wp-api,thickbox,jquery-ui-droppabl&load[]=e,jquery-ui-tabs,jquery-effects-size,jquery-effects-scale,jquery-effects-highlight,jquery-effects-transfer&ver=4.9.8:289)

    And that process continues to repeat over and over.

    I am attempting to solve this as someone who is not trained in server errors – my training is mainly in front end development. However I’ve been tasked to figure this out so any further help is appreciated.

    Moderator bcworkz

    (@bcworkz)

    While whether image files are secured or not is an issue to resolve, I don’t think that is the source of your current issue. There seem to be different errors dependent upon which plugin you are using. All the errors appear to be due to improper coding though, not the inability to find the image file, despite the ultimate “could not find…” error. Error messages can be misleading. I’m not convinced there is a server problem. More likely conflicting code between various WP elements.

    My advice is:
    1. If you don’t have one yet, make a complete backup of the site.
    2. Go into the hosting panel and select the latest stable version of PHP that is available. (if a choice is offered)
    3. Update WP and all themes and plugins to the latest available versions.
    4. Forgetting about image re-processing for the moment, confirm the site is functional on a basic level and is not throwing any errors or warnings.
    5. Switch your current theme to one of the default twenty* themes. Deactivate all plugins except the one image re-processing plugin you prefer to use.
    6. Do a test to re-process an image. It ought to work. If not, make note of any errors logged and seek help from the plugin’s developers for effective resolution.

    If the test works, go ahead and reprocess all the images you need to before trying to restore your site to its normal state.

    Thread Starter suviu

    (@suviu)

    Hi bcworkz,

    Thank you for your posts and assistance. We have a daily backup installed on their website (if no backup had existed, I would have been very hesitant to try and debug this in the first place). Their plugins are up-to-date.

    I will work with someone here to see if we can get a cleaner version of their theme without affecting their business.

    Thank you very much.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Image file paths cannot be found in Media Library’ is closed to new replies.