Comments

tessa bakker’s picture

Issue summary: View changes
Status: Active » Needs review
StatusFileSize
new3.32 KB
matthijs’s picture

Status: Needs review » Active

I don't know if there's any convention about this, but I always use the "jquery." prefix to indicate a jQuery based library + it matches the JavaScript file name.

If I would apply this patch, the imagesLoaded library should be updated accordingly (the "jquery." prefix is missing here as well), but there are other modules that use the current path as well.

tessa bakker’s picture

You can always point other modules to https://www.drupal.org/node/1858390 for the correct folder name.

matthijs’s picture

Status: Active » Closed (won't fix)

That page lists "jquery.imgareaselect" :-)

tessa bakker’s picture

Status: Closed (won't fix) » Needs work

Documentation update (https://www.drupal.org/node/1858390) with new Vendor URL, so this needs some work for imagesloaded.

tessa bakker’s picture

Title: Renaming lib imgAreaSelect is more than needed » Renaming libraries is more than needed and not clear for new users
Priority: Normal » Major
Issue summary: View changes
Status: Needs work » Needs review
StatusFileSize
new6.55 KB

New patch for both libraries with a few extra changes for new users:

- Vendor URL fix of imagesloaded
- Version check, this will fix a lot of support questions ;)
- Added default Libraries API feedback for version and location check
- Drush example make file fix for downloading the libraries to the correct location with some coding style fixes

espurnes’s picture

Patch #6 works for me. Thank you Tessa Bakker.

I've used the libraries defined in README.txt and I've placed them in /sites/all/libraries/imagesloaded and /sites/all/libraries/imgareaselect.

- imagesLoaded:
+ Website: http://desandro.github.io/imagesloaded
+ Download: https://github.com/desandro/imagesloaded/archive/v2.1.2.tar.gz
- imgAreaSelect:
+ Website: http://odyniec.net/projects/imgareaselect
+ Download: https://github.com/odyniec/imgareaselect/archive/v0.9.11-rc.1.tar.gz

NOTE: I tried imgareaselect v1.0.0-rc.1 but it doesn't work, so use v0.9.11-rc.1

espurnes’s picture

In the same website I have Manual Crop with the #6 patch I just installed the module field_slideshow. This second module also needs imagesloaded plugin for best results.

For best results, you should download the JQuery ImagesLoaded plugin and move the downloaded js file(s) into the /sites/all/libraries/jquery.imagesloaded folder of your server.

But this plugin must be placed in /sites/all/libraries/jquery.imagesloaded.
So I need to:

  • unpatch #6 and rename ImagesLoaded folder or
  • ask to the field_slideshow module maintainer to apply a similar patch as #6.

Is there a coding standard that says that jquery plugins must be placed in /sites/all/libraries/jquery.name_of_the_plugin ?
If not, why two different modules needs to rename the downloaded directory to jquery.name_of_the_plugin ?

By now, I will unpatch the #6 and try to use imagesloaded in both modules.

tessa bakker’s picture

There isn't any coding standard that I know of. But it is common to change less as possible.

More examples can be found at: https://www.drupal.org/node/1858390

tessa bakker’s picture

Status: Needs review » Needs work

Patch #6 needs to be tested with Masonry for version conflicts.

Screenshot and more info about this case with ManualCrop 1.5 can be found at #2543668: ImagesLoaded not detected / version conflict.

aguilarm’s picture

+1 for this patch, using the git repo names makes managing your libraries through composer much easier.

kopeboy’s picture

Is there something wrong on how Drupal handles the libraries when there are two with the same/similar name?

  • I have libraries/imagesloaded/imagesloaded.pkgd.min.js as a dependency for Masonry (please note, its author is the same of the imagesLoaded plugin!)
  • I have libraries/jquery.imagesloaded/jquery.imagesloaded.min.js as requested by this module.

Only the first one gets detected, as Drupal says in my Status report.
So I can't use Manual crop at all :/

It's more of a bug than a feature request.. I don't care if I have to rename folders & files as long as the module works :)

OnkelTem’s picture

Not sure if this is correct issue, but Manual Crop just don't work with 7.38: no libraries included at all. I haven't tried patching, I have libraries located just where README suggests.

OnkelTem’s picture

Oh, I see now, such a beautiful things: version detection! Or at least an attempt to detect something. So nice, so brilliant, and so... bad that libraries don't want to support this detection.

Why imagesloaded is not loaded?
Well, basically because 3.1.8 version, which I have to use because of jQuery Update can not be detected with this code hardcoded to 2.1.1:

  $libraries['jquery.imagesloaded'] = array(
    'name' => 'imagesLoaded',
    'vendor url' => 'https://github.com/desandro/imagesloaded/tree/v2.1.1',
    'version arguments' => array(
      'file' => 'jquery.imagesloaded.js',
      'pattern' => '# v([0-9\.]+)#',
      'lines' => 5,
      'cols' => 40,
    ),

Why imgareaselect is not loaded?
Because the version recommended in README which is 0.9.10 never had 'imgareaselect.jquery.json' file on which another progressive piece of code relies:

  $libraries['jquery.imgareaselect'] = array(
    'name' => 'imgAreaSelect',
    'vendor url' => 'https://github.com/odyniec/imgareaselect/tree/v0.9.11-rc.1',
    'version arguments' => array(
      'file' => 'imgareaselect.jquery.json',
      'pattern' => '#"version"[\t ]*:[\t ]*"([^"]+)"#',
      'lines' => 6,
      'cols' => 30,
    ),

No, I'm not against the progress, I just don't get why all this became necessary? Wasn't it enought to have those simple instructions in README — take that, rename to this? wit works woe..

OnkelTem’s picture

StatusFileSize
new1.5 KB

Meanwhile, use this dumb patch to resolve all the issue with libraries.

tessa bakker’s picture

Let restore all the changes and summarize the work that needs to be done for both libraries:

* Create a version callback that works with all versions Checked with all tags for both libraries, not needed
* Note the variants for different versions, no defaults (if possible) Already in patch
** leave the version tag intact for the folder name (if it is an older version?) Not supported
* Change the hook_requirements where needed
* Test compatibility with modules like Masonry and Field Slideshow
* Test compatibility with newer versions of both libraries and add versions where possible

Anonymous’s picture

Status: Needs work » Needs review
StatusFileSize
new8.22 KB

I want to use the latest version of imagesLoaded ('cause that's the version other modules on my site use) but the version checking doesn't work with the latest version. So I've edited the patch to allow for having different versions and it seems to be working fine for me.

aaronbauman’s picture

have been using #17 in production on several sites now to good effect.

rtbc +1

Anonymous’s picture

Status: Needs review » Reviewed & tested by the community
liquidcms’s picture

Status: Reviewed & tested by the community » Needs review

i still don't think this is correct.

i have latest -dev of manualcrop and from README.txt i have:

- https://github.com/odyniec/imgareaselect/archive/v0.9.11-rc.1.tar.gz
- sites/all/libraries/jquery.imgareaselect/jquery.imgareaselect.dev.js

and i still get Error imgAreaSelect Not installed error on status report.

joelhsmith’s picture

@liquidcms I thought I had the same one installed too. It is confusing because they have the same name. See https://www.drupal.org/node/2113383#comment-11178683

This is the compatible version, not the github version: http://odyniec.net/projects/imgareaselect/jquery.imgareaselect-0.9.10.zip

Don't forget to rename it when you move it to the libraries forlder. It should not be dev.js it should be .min.js

dqd’s picture

Priority: Major » Normal
Status: Needs review » Needs work
Issue tags: +drush

1.) I don't see why this is a "major" issue. Don't get me wrong but there are Drupal community agreed standarts to set an issue "major" and has been often misused from the users point of view in a way much too emotional. Practically this issue breaks no code nor is it breaking a side, nor is it in the scope of security concerns.

2.) The README points very clearly dependencies of the module and it is very common between modules of this kind, that you have to try around a little bit with naming and downloading versions. I can understand that it struggles the user, but I can just can tell you, for module maintainers this is often even more annoying, especially when the libraries used have confusing upgrade paths or update cycles.

3.) I personally refuse the last patch firmly, since I am an advocate for correct referencing naming conventions in any possible way to keep sort and order in code. And jquery.nameof is much better than simply nameof IMHO.

4.) I would like to discuss Drush support with the maintainer and the possible hosting of compatible library versions on Github, etc, if the authors lc (cc) allow that (look at other modules) which could prevent more of this issues in the future and what is maybe better maintainable with some automatisms.

fastangel’s picture

StatusFileSize
new9.09 KB

I recreate the patch from #17 for version 1.5

fastangel’s picture

StatusFileSize
new7.28 KB

Updated with rename to jquery.nameOf

fastangel’s picture

StatusFileSize
new6.41 KB

Updated fixing a little bug.

fastangel’s picture

StatusFileSize
new6.77 KB

Fixed last problem to detect version on imgareaselect.

Chris Charlton’s picture

+1. Needs review.

bisonbleu’s picture

Patch in #26 doesn't apply to latest dev version. See terminal output below. I ended up using the versions of the libraries found in the README.

$ patch -p1 < multiple_versions-2504119-26.patch 
patching file README.txt
Hunk #1 FAILED at 20.
1 out of 1 hunk FAILED -- saving rejects to file README.txt.rej
patching file manualcrop.install
patching file manualcrop.make.example
Hunk #1 FAILED at 13.
1 out of 1 hunk FAILED -- saving rejects to file manualcrop.make.example.rej
patching file manualcrop.module
Hunk #1 FAILED at 104.
Hunk #2 FAILED at 158.
Hunk #3 succeeded at 181 (offset -22 lines).
2 out of 3 hunks FAILED -- saving rejects to file manualcrop.module.rej
bisonbleu’s picture

Manually applied @fastangel's code in #26 against the latest dev. A revised and working patch is attached.

Manualcrop now works with either the suggested imagesloaded-2.1.2 or the latest version downloaded from Github, i.e. imagesLoaded 4.1.3.

Status report

p.s. This patch requires that you rename the library folder from e.g. imagesloaded-master to jquery.imagesloaded. See the README for more details.

bisonbleu’s picture

Status: Needs work » Needs review

Setting to Needs review.

Update: Review is required because there's no guaranty that using version 4.1.3 instead of the recommended 2.1.2 will automatically work for all use cases. In other words, if you don't absolutely require 4.1.3, using 2.1.2 might be the prudent way to go.

eg2234’s picture

Patch in #29 worked against 7.x-1.6+3-dev. Didn't test use of imagesLoaded 4.1.3.

jstoller’s picture

StatusFileSize
new7.67 KB

This is the patch from #29, updated to add support for imgAreaSelect version 1.0.0-rc.1.

jstoller’s picture

Title: Renaming libraries is more than needed and not clear for new users » Support newer versions of the imagesLoaded and imgAreaSelect libraries

Renaming issue for findability.

muaz7731’s picture

I have test out the patch from #32.. it seems that the patch start out from docroot not from the folder of the module,in which make it a problem for me when trying to patch the module.
I have change the diff --git location to make it work for me. from:
diff --git a/docroot/sites/all/modules/contrib/manualcrop/... b/docroot/sites/all/modules/contrib/manualcrop/...
to
diff --git a/... b/...

I test it out with:
Drupal: 7.74
manualcrop: 7.14
imagesloaded: 2.1.2
imgAreaSelect: 1.0.0-rc.1

It works. I needed the new imgareaselect so that it can be properly used in mobile web. +1 for RTBC

muaz7731’s picture

Status: Needs review » Reviewed & tested by the community
muaz7731’s picture

StatusFileSize
new6.97 KB

re-edit the patch. having problem (Stripping trailing CRs from patch; use --binary to disable.)