Notice thrown by White Label extension

When a site is protected with basic authentication the following notice is thrown:
Warning: getimagesize(https://staging.kerteza.com/wp-content/uploads/2019/04/Kerteza-logo-small-web-RGB_250px.png): failed to open stream: HTTP request failed! HTTP/1.1 401 Unauthorized in /sites/staging.kerteza.web-004.appsaloon.be/files/wp-content/plugins/tco-white-label/functions/enqueue/styles.php on line 26

I went through the source code and the function getimagesize() is called on the url which of course can not be reached due to the basic authentication.

This can be solved by passing the path to the function getimagesize() instead, since the image path isn’t available in the code where getimagesize() is called.
To change the url to the path, you could use the following snippet:
$upload_dir_info = wp_get_upload_dir();
$some_url_in_uploads = str_replace( $upload_dir_info[‘baseurl’], $upload_dir_info[‘basedir’], $some_url_in_uploads );

A lot of our customers work on staging sites which we sync to their production sites, hence the basic authentication.
Would be great if this could be fixed.
Thanks in advance.

Hello Matth,

Thanks for writing in!

This is a waring message:
Warning: getimagesize(https://staging.kerteza.com/wp-content/uploads/2019/04/Kerteza-logo-small-web-RGB_250px.png)

which means that the image does not exist. You are also seeing this warning because your debug mode is enabled. Can you please disable your debug mode instead? You can do this by opening wp-config.php and adding


define('WP_DEBUG', false);

/* That's all, stop editing! Happy blogging. */

When you revisit the page, you should no longer be seeing the warning message.

Hope this helps.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.