logo
Ask your WordPress questions! Pay money and get answers fast! (more info)

Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.

If the asker does not get an answer then they have 10 days to request a refund.

$39
croping function in buddypress not working

I have a customized wordpress site with the latest version of buddypress 1.5.3.1.

My issue i sthat when users should crop their avatar they see two images but no function wordking.

My site (still under development) is http://crosswide.asia

My GD library is installed
I have tried to disable all plugins without success

I have spent two days on this without success. I have limited knowledge so the fix should be easy to understand and a step by step process.

Thank you,

Olivier

This question has been answered.

olivier | 02/06/12 at 3:15am Edit


(6) Possible Answers Submitted...

See a chronological view of answers?

Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.

  • avatar
    Last edited:
    02/06/12
    3:20am
    Francisco Javier Carazo Gil says:

    Olivier,

    Look at it: http://www.thinkplexx.com/blog/nadi/wordpress-image-croping-does-only-jpeg-buddypress-avatar-cropping-uppload-transparency-problem

    I have been using BuddyPress and this solution was successful.

    • 02/06/12 3:24am

      olivier says:

      Already tried it but this code has already been depreciated. It was not working.

      Uploading an image is working and it looks fine but the crop function is simply taking the upper left corner.

      Olivier

    • 02/06/12 3:29am

      Francisco Javier Carazo Gil says:

      Olivier,

      Are there any JavaScript problems?

      Look at the console. If you want send me FTP details via PM.

    • 02/06/12 3:36am

      Francisco Javier Carazo Gil says:

      I have tested and you have an error in line 206 TOKEN ILEGAL:
      $(�#signup-welcome).p(;:last-child').css('display', 'none');

  • avatar
    Last edited:
    02/06/12
    3:31am
    Pixel Coder says:

    Hi man,

    In the file you run your jQuery functions add the code below.

    Also, this has to come after jQuery and jCrop have been included on the page.

    *edit - Ran into this issue also when building a new theme. The PSEUDO is...

    @javier cool tricks with the png transparency. Does this still exist, i've yet to upload a png that is transparent.

    Include jQuery
    Include jCrop
    Include jCrop CSS (or style yourself)
    Call jCrop where needed (customise as you see fit)
    Update hidden form field values


    jQuery('#avatar-to-crop').Jcrop({
    onChange: updatePreview,
    onSelect: updatePreview,
    setSelect: [ 0, 0, 150, 150 ],
    aspectRatio: 1,
    bgFade: true,
    bgOpacity: .3,
    minSize: [150, 150]
    },function(){
    // Use the API to get the real image size
    var bounds = this.getBounds();
    boundx = bounds[0];
    boundy = bounds[1];
    // Store the API in the jcrop_api variable
    jcrop_api = this;
    });

    function updatePreview(c)
    {
    if (parseInt(c.w) > 0)
    {
    var rx = 150 / c.w;
    var ry = 150 / c.h;
    $('#x').val(c.x);
    $('#y').val(c.y);
    $('#w').val(c.w);
    $('#h').val(c.h);

    jQuery('#avatar-crop-preview').css({
    width: Math.round(rx * boundx) + 'px',
    height: Math.round(ry * boundy) + 'px',
    marginLeft: '-' + Math.round(rx * c.x) + 'px',
    marginTop: '-' + Math.round(ry * c.y) + 'px'
    });
    }
    };


    Let me know how you get on.

    Previous versions of this answer: 02/06/12 at 3:28am | 02/06/12 at 3:31am

    • 02/06/12 3:34am

      olivier says:

      Hi,

      should I put it in the file

      bp-core-avatars.php?

      Thanks, not sure where those functions are run.

    • 02/06/12 3:35am

      Pixel Coder says:

      @john Tried running the above code via console and it looks like those errors don't terminate the script.

      Bit of a JS noob here, any ideas what JS errors are considered fatal? The console is returning a Type and Syntax error.

      Maybe the console will allow code execution regardless of errors in a "sandbox" type environment.

      Ah who knows. Is it legitimate to have side convos here? :p

    • 02/06/12 3:39am

      Pixel Coder says:

      If you give me FTP i'll get this on for you.

      Works fine, tested as you can see from the latest Avatar on your site.

    • 02/06/12 3:41am

      olivier says:

      OK Alistair,

      your picture looks centered.

      any email where I can send you my ftp access?

    • 02/06/12 3:43am

      Pixel Coder says:

      Hello,

      alistair at pixelcoder dot co dot uk

      You should also be able to send a message via wpquestions.com

    • 02/06/12 3:45am

      olivier says:

      Just joined this platform. Wish I had found it before. I just sent you a mail. Olivier

    • 02/06/12 3:56am

      Pixel Coder says:

      Yes, it's very good.

      You're all set now, lift-offfff. :)

    • 02/06/12 4:01am

      olivier says:

      I will check immediately ;-)

    • 02/06/12 4:04am

      olivier says:

      My site is blank! only the buddypress bar remains....

  • avatar
    Last edited:
    02/06/12
    3:26am
    Viruthagiri Thirumavalavan says:

    Could you please give us demo login details?. So we can test it

    • 02/06/12 3:38am

      olivier says:

      Hi,

      I have no demo login but you can register...I'll delete your profile after.

      http://crosswide.asia/register/

      Olivier

  • avatar
    Last edited:
    02/06/12
    3:27am
    John Cotton says:

    I get an error on that page, line 206:

    This


    <script type="text/javascript">
    $(�#signup-welcome).p(;:last-child').css('display', 'none');
    </script>


    should be

    <script type="text/javascript">
    $('#signup-welcome').p(;:last-child').css('display', 'none');
    </script>


    Fix that and I can look at the next bit...

    • 02/06/12 3:39am

      olivier says:

      Hi John,

      which page address exactly?

      thanks,

      olivier

    • 02/06/12 4:18am

      John Cotton says:

      The homepage

  • avatar
    Last edited:
    02/06/12
    3:56am
    Arnav Joy says:

    find out this
    <script type="text/javascript">

    $('#signup-welcome').p(;:last-child').css('display', 'none');

    </script>

    in header.php or in the js of the plugin for signup

  • avatar
    Last edited:
    02/06/12
    4:17am
    idt says:

    Hi,

    As others have mentioned, please try fixing first the jQuery line with incorrect syntax in your site. I think this:

    <script type="text/javascript">
    $(�#signup-welcome).p(;:last-child').css('display', 'none');
    </script>

    should have been:
    <script type="text/javascript">
    $('#signup-welcome .p:last-child').css('display', 'none');
    </script>
    or
    <script type="text/javascript">
    $('#signup-welcome p:last-child').css('display', 'none');
    </script>

    Either of the two line is correct syntax, so just try it for the meantime just to see what happens if that line is fixed.

    That line of code maybe found in your header.php of your theme. That could might be the cause why other js functions on your site stopped working.

    Thanks,
    idt

    Previous versions of this answer: 02/06/12 at 4:17am

    • 02/06/12 4:16am

      idt says:

      olivier says:
      My site is blank! only the buddypress bar remains....


      I noticed that too. Did you have someone work on it?

      Thanks,
      idt

    • 02/06/12 4:18am

      olivier says:

      Yes Alistair took the lead so I put it on hold.

This question has expired.



Gabriel Reguly, idt, Kannan C, Francisco Javier Carazo Gil, Arnav Joy, olivier voted on this question.



Current status of this question: Completed



Warning: Please do not give out any FTP or ssh credentials to anyone, unless you trust them completely. Giving out login details is dangerous.

If the asker does not get an answer then they have 10 days to request a refund.