Mecanik / cloudflare-image-resizing

CloudFlare Image Resizing plugin for WordPress.
MIT License
66 stars 13 forks source link

The URL with the folder causes the plugin to be configured incorrectly #34

Closed dwilkiewicz closed 1 year ago

dwilkiewicz commented 1 year ago

Hi, I am passing https://example.com/blog as a site url in wp-admin plugin general settings (plugin version 1.5.2), it was saved in config.php as this

define('CF_IMAGE_RESIZING_SITE_URL', 'https://example.com/blog');
define('CF_IMAGE_RESIZING_SITE_FOLDER', '');

Generated Cloudflare URLs are wrong with these settings.

I expected:

define('CF_IMAGE_RESIZING_SITE_URL', 'https://example.com');
define('CF_IMAGE_RESIZING_SITE_FOLDER', '/blog');

Plugin works fine with these settings, but it's impossible to configure this from wp-admin plugin settings.

Mecanik commented 1 year ago

Hi, I am passing https://example.com/blog as a site url in wp-admin plugin general settings (plugin version 1.5.2), it was saved in config.php as this

define('CF_IMAGE_RESIZING_SITE_URL', 'https://example.com/blog');
define('CF_IMAGE_RESIZING_SITE_FOLDER', '');

Generated Cloudflare URLs are wrong with these settings.

I expected:

define('CF_IMAGE_RESIZING_SITE_URL', 'https://example.com');
define('CF_IMAGE_RESIZING_SITE_FOLDER', '/blog');

Plugin works fine with these settings, but it's impossible to configure this from wp-admin plugin settings.

The CF_IMAGE_RESIZING_SITE_URL is not meant for what you think it is. It is there because Cloudflare allows you to use another domain for resizing images (for example, you can have one domain/zone and use that service to resize images anywhere).

What you are looking for is the CF_IMAGE_RESIZING_SITE_FOLDER, which is exactly how you configured it. So you configured it properly, you just didn't understand it.

dwilkiewicz commented 1 year ago

I understand how config.php works, and if I still should configure it manually, it's ok. But it's not obvious how wp-admin plugin general settings maintain config.php and I think it's impossible to configure CF_IMAGE_RESIZING_SITE_FOLDER from wp-admin. Anyway, thanks for your work.