- 🇪🇸Spain candelas
Thanks @SocialNicheGuru , I was having problems configuring the local library and your image helped to me.
From the README.md file of Image Widget Crop module:
* Local library:
1. Download the latest version of [Cropper].
2. Copy the dist folder into:
- /libraries/cropper/dist
3. Enable the libraries module.
After doing the above for Cropper Library version v3.1.3 (I've tried the same for v3.1.6, and latest v4.0.0, with same results), this is how the directory looks like:
/libraries/cropper/dist
|_ cropper.css
|_ cropper.js
|_ cropper.common.js
|_ cropper.esm.js
|_ cropper.min.css
|_ cropper.min.js
My settings at admin/config/media/crop-widget ('Custom Cropper library' and 'Custom Cropper CSS file') are empty. The note there says:
Set the URL or local path for the file, or leave empty to use the installed library (if present) or a CDN fallback. You can retrieve the library file from Cropper CDN.
Even though the Cropper library is present at /libraries/cropper/dist, on my site, I see that the default CDN is still being used, not my local libraries. I have to copy (not cut) all files from /libraries/cropper/dist to /libraries/cropper (which means I need to have those files at both locations), for local files to be picked up. There might be some issue with the code.
I have discovered the following:
// If Libraries exist and cropper library is available via Libraries API.
elseif (\Drupal::moduleHandler()->moduleExists('libraries')
&& ($info = libraries_detect('cropper'))
&& $info['installed']) {
$info['installed'] returns False, so local libraries are not used, this should have been True.
Array(
[name] => cropper
[vendor url] => https://github.com/fengyuanchen/cropper
[download url] => https://cdnjs.com/libraries/cropper
[version arguments] => Array(
[file] => cropper.min.js
[pattern] => /Cropper v(.*)/
[lines] => 2
)
[files] => Array(
[js] => Array(
[cropper.min.js] => Array()
)
[css] => Array(
[cropper.min.css] => Array()
)
)
[module] => image_widget_crop
[machine name] => cropper
[path] =>
[library path] => libraries/cropper
[version callback] => libraries_get_version
[dependencies] => Array()
[variants] => Array()
[versions] => Array()
[integration files] => Array()
[callbacks] => Array(
[info] => Array(
[0] => libraries_prepare_files
)
[pre-detect] => Array()
[post-detect] => Array(
[0] => libraries_detect_dependencies
)
[pre-load] => Array()
[post-load] => Array()
)
[installed] =>
[version] =>
[error] => not detected
[error message] => Drupal\Core\StringTranslation\TranslatableMarkup Object(
[translatedMarkup:protected] =>
[options:protected] => Array()
[stringTranslation:protected] =>
[string:protected] => The version of the %library library could not be detected.
[arguments:protected] => Array(
[%library] => cropper
)
)
)
Note that installed, version are empty, and the error message. This leads to the code thinking the library is not installed locally, and hence uses the default CDN.
If I copy the cropper.min.css and cropper.min.js from /libraries/cropper/dist to /libraries/cropper, the above looks like:
Array(
[name] => cropper
[vendor url] => https://github.com/fengyuanchen/cropper
[download url] => https://cdnjs.com/libraries/cropper
[version arguments] => Array(
[file] => cropper.min.js
[pattern] => /Cropper v(.*)/
[lines] => 2
)
[files] => Array(
[js] => Array(
[cropper.min.js] => Array()
)
[css] => Array(
[cropper.min.css] => Array()
)
)
[module] => image_widget_crop
[machine name] => cropper
[path] =>
[library path] => libraries/cropper
[version callback] => libraries_get_version
[dependencies] => Array()
[variants] => Array()
[versions] => Array()
[integration files] => Array()
[callbacks] => Array(
[info] => Array(
[0] => libraries_prepare_files
)
[pre-detect] => Array()
[post-detect] => Array(
[0] => libraries_detect_dependencies
)
[pre-load] => Array()
[post-load] => Array()
)
[installed] => 1
[version] => 3.1.3
)
And now I see that the cropper.min.js and cropper.min.css are correctly loaded from my local.
I use composer to install the Cropper library from https://github.com/fengyuanchen/cropper, so it comes with dist directory. I do not want to manually copy files from dist to its parent directory. But I do not know how to patch this.
Closed: works as designed
2.2
Code
Not all content is available!
It's likely this issue predates Contrib.social: some issue and comment data are missing.
Thanks @SocialNicheGuru , I was having problems configuring the local library and your image helped to me.