Added views 2 support

Optimizations:
1) db_query for presets replaced by ImageCache API call imagecache_presets() which are cachable
2) Images for views rendered same way as default imagecache_profiles_preprocess_user_picture
3) variables store preset ID against preset Name - less storage place and flexibility in renaming presets

Another idea to skip default theme('image'... because template_preprocess_user_picture already produce valid $variables['picture'] so no need to render it again

views.zip should be unzipped into imagecache_profiles folder

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Bevan’s picture

subscribing

bensemmel’s picture

Patch and views integration are working fine for me. Thank you very much

Regards,
Ben

japanitrat’s picture

w0rks on the 6.x-1.0 release (version here says 6.x-1.x-dev, didnt test that one)

fred0’s picture

I can also attest that this works well on the 1.0 version (didn't try dev). Thanks!

gallamine’s picture

How exactly does this allow integration with Views2? For instance, does it allow me to pull the various profile images for a given user, or just the default one? Sorry for my daftness. I installed the patch/code and I can't discern the changes.

gallamine’s picture

Actually, after more poking, the patch/code has borked some things. Now, the "User: Picture" field in Views no longer pulls the "default" picture, but instead pulls the full-sized original picture. Any thoughts on how to reverse this (aside from simply replacing the module)?

Flying Drupalist’s picture

Hi this would be a great feature.

flickerfly’s picture

I'm not sure so I'm asking...

Does "Views 2 Support" include the idea that I could select the imagecache preset to display the user profile picture with in that view? ImageCache and Views alone do that, but I don't seem to have the option when dealing with a profile picture. If not, I'll just make a new feature request out of this, but am trying to avoid duplication.

Thanks!

Flying Drupalist’s picture

Hi, what is the status of this? Can this be committed?

sedat44’s picture

subscribing

andypost’s picture

When choosing User:Picture imagecache preset should be chosen

Suppose it's ready for commit,
only one thing - how to make default selection of imagecache preset?

If there's someone to write AI for selection - it's not ready :)

Roulion’s picture

subscribing too

frankcarey’s picture

The patch above changes the way the variables are stored, namely it stores the preset id, not the preset name. This is probably best , just in case the preset names are changed (the preset id will remain the same). If you have this module installed and presets are set, then install the patch above, two problems occur:

1) Settings are blank in /admin/user/settings

2) Profile images shown as original size throughout site.

3) Since the variables are wrong, views that have user: picture will display the original image (unless you actually set it in the view)

What I have here is an .install file.

To install:
1) make sure you install the patch above first
2) put this file in the imagecache_profiles/ directory
3) change the name to imagecache_profiles.install
4) run update.php.

If you haven't overwritten your old settings, the update will convert them to thier respective preset id, and everything should work fine. I think with this file the whole package is ready for a commit.

Also included is an uninstall function, so if you uninstall it later it will remove any variable set by imagecache_profiles.

frankcarey’s picture

Big thanks to andypost for doing the views integration, much appreciated! Lets get this thing committed :)

Here is a new version of views/imagecache_profiles.views.inc (patch can be made if the original patch is committed), that selects the site wide default preset as the default preset in views. Also, the blank line is replaced by 'let imagecache_profiles decide', which should pass off the decision to the imagecache_profiles preset decision workflow (are we on a user page, viewing a comment, etc).

Though one could argue to make ('let icp decide') should be the default, since it will do some checking about what image to use, the site wide default may be better to use for views since imagecache_profiles can get a little confused. For Example, the user_relationships panel that comes with APK will show the user_page preset, and not the site_default preset if 'let ipc decide' is chosen. ICP gets confused because the block resides on a panel at user/%, so it thinks the (i'm guessing larger) user picture should be shown, even though the user is really a 'friend' of the current user. Considering that views are lists, always using the site default probably makes more sense.

BTW I think ' let imagecache_profiles decide' is fairly short and certainly more descriptive than the blank line, perhaps the wording could be improved (or maybe we should add a better help text to the form?)

frankcarey’s picture

One more note: for the longest after I installed the patch, i didn't see any preset options in the view's admin/edit page, which got very frustrating, but caused me to look much closer at the module and add these patches, so I guess it turned out for the best. I see some others in this post having the same issue. I'm not sure exactly what fixed it, but for any others having that issue, try flushing all your caches, maybe that did it.

andypost’s picture

@TextPlease What are patch #14 about? this file is the same included in views.ZIP

.Install File is realy good idea to migrate new variables format

So maybe some review this patches (main in issue and #13)

frankcarey’s picture

huh, I'll have to resend it. It's not mission critical though... patch can be applied later

andypost’s picture

.install file is required because it contains update for variables which stores preset ID aginst preset Name as I describe in issue

So final patch:
1) patch + views.zip in issue
2) .install file from #13 - which migrate variables and Add uninstall to module

Flying Drupalist’s picture

forgot the attachment?

andypost’s picture

Little bit code-style and formatting for .install file

(.txt should be removed)

andypost’s picture

tracking cvs HEAD + default avatar selection in views

imagecache_profiles.install.txt should be renamed to imagecache_profiles.install

views.zip extracts inside imagecache_profiles folder

bcn’s picture

FileSize
8.32 KB

Here's everything from #21 in one patch...
Views works great!

Thanks!

Let's hope this can get committed soon ;)

mariusooms’s picture

Just patched with patch from #22, patch patched flawless. I completely uninstalled the module installed the new version, ran clear cache, update.php, cron you name it, but no new handler is shown for user: picture in views. I'm using the latest dev from views, which seem to have many new enhancements. Could this be the issue?

Anyone else having problems like this?

Regards,

Marius

lelizondo’s picture

It works, here's what I did:

1. Disabled imagecache_profiles
2. Extracted views.zip into imagecache_profiles
3. Replaced .install into imagecache_profiles with the .install from #20
4. Applied patch #22

The patch asked me if I wanted to create the views files and the .install file. I said no since I did it manually in steps 2 and 3.

Enabled the module.

Now I have views support for User Picture. So cool!

Thumbs up! I'd like to see this committed soon.

dtarc’s picture

I was having a problem getting this working. I misunderstood and put the views dir with the handler in a subdirectory of the views module, it should just be in the imagecache_profiles module folder (as mentioned).

It seems to be working well. I hope this could be committed and rolled out in a new version, even just a dev snapshot.

xqbzzr’s picture

Hm.. sounds good to me, but as a total noob i ran into a "View is protected" warning, while following the list in #24. So i quickly deinstalled everything and changed back to original files. Can you please give advise wether i should take the plunge with this or just wait for the next release (if anyone is planned at all)?
How exactly do i "apply" the patch?
Thank you for help!

lelizondo’s picture

Follow instructions in #24.. If you don't know how to apply the patch go to http://drupal.org/patch/apply

mariusooms’s picture

Patch #22 is actually fine...but it does not create a views folder, so make sure to stick the views files in the views folder if you just use the patch.

Regards,

Marius

andypost’s picture

maybe someone test this patch and set it to RTBC
suppose, enough people already agree with this way so we need attention of maintaner

mariusooms’s picture

Status: Needs review » Reviewed & tested by the community

I tested it today after realizing my earlier error. It works as described. As tested by at least three people in this issue. Maybe re-roll the patch of #22 to create the views folder during patching.

Regards,

Marius

jhedstrom’s picture

This patch works great. The patch in #22 creates the views folder on Linux, so it may be OS dependant, but I'm not sure.

frankcarey’s picture

@ jhedstrom : I don't think patch files are os dependent, though the "patch" command is probably only available from the command line in linux. Other os gui versions of the patch program should be able to work fine.

jhedstrom’s picture

@frankcarey

I didn't mean to imply that the patches themselves were OS dependant, but only that the implementation of the 'patch' command may vary since some people were reporting that the patch didn't properly create the views directory.

JohnFilipstad’s picture

This is great! Looking forward to a 6.x-1.1 release.

Taz’s picture

This patch is great, exactly what I needed. Any chance of a dev release for 1.1?

chrisroditis’s picture

Great patch! Thanks!

sammys’s picture

Works wonderfully! Thanks!

lelizondo’s picture

will this be ported? At least 6 people said this patch it's working so this it's already 'reviewed & tested by the community'.

v1nce’s picture

Assigned: Unassigned » v1nce
Category: task » feature

Yes it will, once I get some time to carve out for patch reviews and updates on this module.

dnewkerk’s picture

Tested out the patch as well... works perfect. The new Views options make this a must-have module for me from now on. Thanks andypost and everyone, looking forward to the release :)

jcmarco’s picture

This patch works great,

Once applied this patch you need to create a views directory and move imagecache_profiles.views.inc and imagecache_profiles_handler_field_user_picture.inc
on it. I found that problem with Windows and Linux servers.

Not using default Imagecache API function in the original module was doing that it didn't work with default imagecache presets.

The additional Views integration feature is a must and it is a enough reason to release at least a new imagecache_profiles version.

Thanks for that work.

webanalya’s picture

Hi,

I followed the lelizondob's instructions (#24) (except that I applied the patch manually) and everything works! great!

thanks you very much !

ayalon’s picture

I tested the patch and its working. I'm using it on a live site.

entr3p’s picture

This patch works great! I'm using this patch on a live site as well and it works flawlessly.

+100

najibx’s picture

patches should be committed soon?

entr3p’s picture

Hopefully. It seems this module hasn't been updated in a while, even though it's fairly popular.

lelizondo’s picture

according to #39, the maintainer of this module it's busy right now.. maybe someone could offer to be co-maintainer and upload some tested patches..

andypost’s picture

I already ask for co-maintainship but rejected

entr3p’s picture

Hmm. I REALLY think this module needs a co-maintainer if the main maintainer doesn't have too much time for the module.

dtarc’s picture

This is an important module and the views integration is great. Please commit the patch!

pribeh’s picture

This works superbly! Thanks so much for this. I was wondering if anyone here would be able to help me with my issue (here: http://drupal.org/node/491446). Perhaps the same methodology could be applied to other picture fields such as the one I raise in my issue thread. Any help would be uber appreciated!

lelizondo’s picture

FileSize
12.4 KB

Seems like there's not much activity here and that this patch won't be commited soon (hope I'm wrong). Anyway, here it is a .zip version with the module already patched and working so new users won't have to patch it anymore.

entr3p’s picture

Good job lelizondob! Hopefully this helps others out.

patchak’s picture

Installed the module in #52, works perfectly, it's definately RTBC IMO

+1

jrabeemer’s picture

+1 commit patch

andypost, I'm sure you can get commit access from v1nce if you take on the other patches in the queue not just this one.

v1nce clearly doesn't have the time to work on the module. :-(

andypost’s picture

@v1nce it you have no time, maybe you make me a co-maintainer? I start 2.0 branch and module get new blood

pribeh’s picture

Uber plus, Double plus recommendation here!

mairav’s picture

Suscribing. I hope a new version can be release with this patch.

I replaced my imagecache_profiles folder with the one comitted in #52, run update.php and everything is working. Thanks "lelizondob" for the zip folder! and everybody for your help.

lelizondo’s picture

@mairav: please don't give me credit.. I didn't do the patch, I just created a zip..

mattiasj’s picture

This is perfect, I will try it asap and of course hoping it will be commited in a new version for our multi site install to use.

mairav’s picture

@lelizondob I just wanted to thanks you for the zip, cause that made my life easier. I don't know if I could have done this without that zip. In that message I thanked to those who made the patch too!

Thanks again to everyone. :D

mrfelton’s picture

lets get this committed soon! subs

TC44’s picture

This is brilliant, thanks for the patch!

urbanbricks’s picture

Thaaaaank you for this zip. It is MOST helpful to have Imagecache Profiles module enable the preset dropdown on Views. It would be super helpful if the maintainer would commit this patch! :)

Bevan’s picture

Assigned: v1nce » Unassigned
Priority: Normal » Critical
Kane’s picture

I'm not really that into php, but i think this patch causes error with image creation with latest ImageCache module.

Looks like it has something to do with
imagecache_profiles.install file, cause after i've updated it all images stopped to process and in html they have wrong path.
During update i've got his line:
# user_picture_imagecache_profiles updated from preset1_name to 2
# user_picture_imagecache_comments updated from preset2_name to 1

and path to files changed accordingly from
imagecache/preset1_name/image/image.jpg
to
imagecache/1/image/image.jpg

for other preset respectivly.

UPDATE:
It seems that in path to image used id of imagecache preset.

Kane’s picture

Kane’s picture

Forget that i wrothe about succesfull patching.
Flushed cache and nothing works again.

If anyone have latest version of modules can you confirm that this patch doesn't work anymore.

Kane’s picture

Ok, forgot all that crap which i wrote erlier, problem was in rewritten function about which i forgot after update.

lelizondo’s picture

the last commit to this module was on December 19 so I don't really know what you mean with 'this patch doesn't work anymore'.

Maybe you found a new bug, but more than 10 users in this post said this was working. Try not to use the patch but the .zip in #52.

If you found a new bug, I don't really know what to tell you, this module seems to be 'almost' abandoned.

christefano’s picture

Status: Reviewed & tested by the community » Needs review
FileSize
8.92 KB

The last patch had Windows line endings. Please review this one.

Folks, let's get a good patch together before there's talk of mutiny.

Manuel Garcia’s picture

patch looks to have worked fine here, though i kinda had to hack at a bit, since i didnt have the views directory.

I'm not changing the status to reviewed and tested by community til someone tests it properly.

++

crea’s picture

@andypost I think you should really request transferring of maintainership through Drupal.org team. Abandoned projects should eventually get new maintainers disregarding original author denial and I think there's procedure for that on Drupal.org.

christefano’s picture

Indeed: Dealing with abandoned projects

Please open a new issue for questions about maintainership.

andypost’s picture

I know about Abandoned projects but right now i have no time to do it. Just wait a week or two but maybe v1nce will back this time.

The issue was already filed so I open it again #426634: Is this module still maintained?

andypost’s picture

Status: Needs review » Fixed

Committed to HEAD

Enabled 6-dev release so waiting for tarball to rebuild

Manuel Garcia’s picture

wohooo! wtg andypost!

And thanks to v1nce for allowing you cvs access =)

let's wait for the tarball, test it, and hopefuly get a new stable release with this change in soon !

pribeh’s picture

yah!

lelizondo’s picture

good news! thanks everybody

andypost’s picture

commited to 6-dev
now tarball should be right

entr3p’s picture

Wow great! Finally lol

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Sinan Erdem’s picture

Status: Closed (fixed) » Active

Sorry to reopen this issue...
I downloaded and setup the latest version of this module. Now, in Views, adding a User:picture field, I don't see the imagecache preset dropdown.
Using Drupal 6.20. Already run update.php and cleared caches...

andypost’s picture

Status: Active » Closed (fixed)

@etcetera9 please open new issue and provide more info. Do you tried to clear views cache?