Question on integrating an image cropping tool

13 years 1 month ago #158618 by sfraise
I'm going to start working on integrating an image upload/cropping script for the main avatar and wanted to see if my initial idea is on the right track or not.

I plan on adding the link to the upload/crop modal window under the avatar, from there you will select the image you want to upload and then crop it. My initial idea on this is to define the $submitvalue as the cropped image being saved and then fire the userAvatar($option, $uid, $submitvalue) function onclick.

Am I way off track with the userAvatar function? If so what do I need to do in order to pass the cropped image to the cb avatar upload function and have it run as if the user simply added that cropped image to the default image upload and saved it?

Please Log in to join the conversation.

13 years 1 month ago #158629 by krileon
It maybe easier to make a new image fieldtype plugin that provides a field to do exactly what you're wanting then simply store that fields value on save to the avatar database column. This would prevent you from having to alter the core (to add your link and such). Example of fieldtype plugins is our ajax text and file fieldtype plugins.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

13 years 1 month ago - 13 years 1 month ago #158646 by sfraise
Thanks for the advice Krileon, I think we're just going to create a plugin that will take the place of the cb image upload and write the cropped image and thumbnail to the db manually. We use cbprofilepro so instead of including the default avatar edit we'll just include the new plugin and call it good. Just easier and faster all the way around.

I'm working on a much tougher part now, I have to change the add connection functionality to work and look more like Facebook. On top of that I have to add the functionality to add a connection from within an ajax search result in it's own component. My original idea was to just replace the connection functionality altogether with my own but it seems it's a bit more complex than I first thought. I set up the functionality to properly write the new connection to the comprofiler_members table but that's it, I didn't put in the messaging functionality or anything like that. However I noticed that simply having the connection written in the db doesn't work at all as the pending friend doesn't appear in the connections tab which kind of baffles me. I figured that it was simply looking in the members table and pulling any row with your id in it, pulling the comprofiler table row with the referenceid, and then displaying the data from that, but obviously that's not the case. What else is going on there in order for the friends and pending friends to display in the user's connections tab?

On top of that the UI for this connections thing calls for a modal window to pop up from within the ajax results but I can't figure out for the life of me how to get anything to fire in the ajax results div, but that's neither here nor there, just one of those little things that frustrate you. The same with all of the stupid IE issues I'm running into with this ajax member search, there's just too many scripts all working together at the same time I think. I also still have to set up a mutual friends function to somehow figure how many mutual friends are between the search result member and the searching member. I ran through it in my head a bit but I'm not sure exactly how to do it efficiently without having a long queries running through a loop. I can't imagine it will be nice on the resources if it's running through a loop of all members over and over with say 100,000 members. I'll figure it out when I get there I guess, for now I gotta figure out how to do this connections thing.

Please Log in to join the conversation.

13 years 1 month ago #158706 by krileon

What else is going on there in order for the friends and pending friends to display in the user's connections tab?

As far as I am aware it's just usage of the _comprofiler_members table. But you need to ensure your direct inserts are being done correctly and all the data required is being added. Please review the tables structure closely.

but I can't figure out for the life of me how to get anything to fire in the ajax results div

You're likely going to need to use live binds (assuming you're using jQuery). For instance if you need something to fire on click for ajax results you need to live bind the click handler so it'll fire regardless of when the selector was added to the DOM. Example as follows.
$( SELECTOR ).live( 'click', function() {


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

13 years 1 month ago #158765 by sfraise
The only difference I can see in the db from the manual insert is the NULL values are not italic like the regular ones are, null is null is null right?

I'll give setting up a live binder on the click a try, didn't think of that.
Hopefully I can finally get this component finished up this weekend and get the params set up so I can release the basic component.

Please Log in to join the conversation.

13 years 1 month ago #158969 by krileon

The only difference I can see in the db from the manual insert is the NULL values are not italic like the regular ones are, null is null is null right?

Direct queries shouldn't be used at all for connections as CB provides perfectly usable API to establish connections. See the cbConnection class in comprofiler.class.php for usage information.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in to join the conversation.

Moderators: beatnantkrileon
Time to create page: 0.273 seconds

Facebook Twitter LinkedIn