Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'crop'

Viewing 25 results - 51 through 75 (of 1,245 total)
  • Author
    Search Results
  • #321033

    Thank you!

    Here is complete script for this:

    // Setup
    $path = 'some/folder/where/is/prepared/image.jpg'; // EXAMPLE
    $user_id = 123; // EXAMPLE
    $upload_path = bp_core_avatar_upload_path();
    $upload_dir = 'avatars';
    
    // Define filename and data
    $filename = pathinfo($path, PATHINFO_BASENAME);
    $data = file_get_contents( $path );
    
    // Prepare final destination
    $user_upload_dir = "${upload_path}/${upload_dir}/${user_id}";
    
    if( !is_dir( $user_upload_dir ) ) {
    	wp_mkdir_p( $user_upload_dir );
    	
    	if( !is_dir( $user_upload_dir ) ) {
    		return false;
    	}
    }
    
    // Prepare temp image
    $img = "${user_upload_dir}/{$filename}";
    $fc = file_put_contents( $img, $data );
    
    // Get size
    $image_size = getimagesize( $img );
    $width = $image_size[0];
    $height = $image_size[1];
    
    // Save avatar and assign to user
    $res = bp_attachments_create_item_type( 'avatar', [
    	'item_id'   => $user_id,
    	'object'    => 'user',
    	'component' => '',
    	'image'     => $img,
    	'crop_w'    => $width,
    	'crop_h'    => $height,
    	'crop_x'    => 0,
    	'crop_y'    => 0,
    ] );
    
    // Delete temp file
    wp_delete_file( $img );
    sx1001
    Participant

    Hi,

    I’m searching a API function to use a local server jpg-file / photo from the server from elsewhere (not yet in the wp-content/uploads/ folder) and add it to the foto library of a specific user. I do NOT want to update avatar or cover image, just add it to the users media library.

    By doing so, I do not need to use crop, I just want the API function to move/copy the file to the appropriate media upload folder and create the SQL entries.

    In the whole media-functions.php file, I found only the “bp_media_add” which seems to ADD a foto – but there is no “file” parameter. How can I specify which file I wanna use?

    I also found bp_media_handle_sideload() but it seems to also only be able to use a file uploaded by a Form, i.e. $_FILES[].

    If possible, I’d like to also specify a meta-entry for the foto/attachement so I can later access it via some function / custom sql query (i.e. fetch the HTTP-URL of the image for a specific user id)

    Any ideas?

    Thanks!

    #320111
    aliforty
    Participant

    Important followup notes:

    -BuddyPress is correctly processing, cropping, and uploading images to WordPress

    -These other plugins are also installed in the same server:

    BuddyPress Xprofile Custom Field Types: Version 1.1.9

    BuddyPress for Timber: Version 1.1

    BP Better Messages: Version 1.9.8.165

    bbPress: Version 2.6.6

    #318505
    lynnapp
    Participant

    I am also looking for this. If not cropping then allowing them to choose the top, middle, bottom part of an image

    #318101
    michaelburnell1
    Participant

    Why hasnt buddy press come up with a solution to crop or position the cover photo section im really struggling to make any cover photo look nice.

    lordmatt
    Participant

    What would really help me would some way I can search out answers in the form “what do I need to hook or filter to do X?” I’ve found myself going to SO a lot with things I am stuck on.

    For me, BuddyPress is a giant black box of mystery.

    One suggestion I can make about this forum would be to get a few moderators tasked with “X not working” posts into one board as those crop up everywhere at the moment.

    simon_a6
    Participant

    We have a problem whereby the user is uploading a photo that is not square. On a PC it’s fine and gives you the ‘crop’ method. But on a cellphone, you get the error: An error occurred. Please try again later.

    What’s that about?

    #316062
    Jake Ward
    Participant

    Hi,

    We’ve been struggling with an issue on our site now for a while.

    When users are uploading profile pictures on mobile, they appear way too big in the cropping page and overrun the page to the point where you can barely see the full image.

    We have implemented some css that zooms out the container which helps, but causes weird behaviours when users are trying to crop the image.

    Can anyone advise on this please?

    Thanks
    Jake

    zloro
    Participant

    debug.log contents:
    [22-Nov-2020 08:49:23 UTC] PHP Fatal error: Uncaught Error: Call to undefined function ctype_digit() in wp-content/plugins/buddypress/bp-core/bp-core-avatars.php:760
    Stack trace:
    #0 wp-content/plugins/buddypress/bp-core/bp-core-avatars.php(848): bp_core_delete_existing_avatar(Array)
    #1 wp-includes/class-wp-hook.php(287): bp_avatar_ajax_delete(”)
    #2 wp-includes/class-wp-hook.php(311): WP_Hook->apply_filters(”, Array)
    #3 wp-includes/plugin.php(478): WP_Hook->do_action(Array)
    #4 wp-admin/admin-ajax.php(176): do_action(‘wp_ajax_bp_avat…’)
    #5 {main}
    thrown in wp-content/plugins/buddypress/bp-core/bp-core-avatars.php on line 760
    [22-Nov-2020 09:04:58 UTC] PHP Fatal error: Allowed memory size of 2097152 bytes exhausted (tried to allocate 4096 bytes) in wp-includes/formatting.php on line 4130
    [22-Nov-2020 09:04:58 UTC] PHP Fatal error: Allowed memory size of 2097152 bytes exhausted (tried to allocate 4096 bytes) in wp-includes/load.php on line 1210
    [22-Nov-2020 09:05:06 UTC] PHP Fatal error: Allowed memory size of 2097152 bytes exhausted (tried to allocate 4096 bytes) in wp-includes/formatting.php on line 4130
    [22-Nov-2020 09:05:06 UTC] PHP Fatal error: Allowed memory size of 2097152 bytes exhausted (tried to allocate 4096 bytes) in wp-includes/load.php on line 1210
    [22-Nov-2020 09:05:41 UTC] PHP Fatal error: Allowed memory size of 2097152 bytes exhausted (tried to allocate 4096 bytes) in wp-includes/formatting.php on line 4130
    [22-Nov-2020 09:05:41 UTC] PHP Fatal error: Allowed memory size of 2097152 bytes exhausted (tried to allocate 4096 bytes) in wp-includes/load.php on line 1210
    [22-Nov-2020 09:05:44 UTC] PHP Fatal error: Allowed memory size of 2097152 bytes exhausted (tried to allocate 4096 bytes) in wp-includes/formatting.php on line 4130
    [22-Nov-2020 09:05:44 UTC] PHP Fatal error: Allowed memory size of 2097152 bytes exhausted (tried to allocate 4096 bytes) in wp-includes/load.php on line 1210
    [22-Nov-2020 09:17:09 UTC] PHP Fatal error: Uncaught Error: Call to undefined function ctype_digit() in wp-content/plugins/buddypress/bp-core/bp-core-avatars.php:760
    Stack trace:
    #0 wp-content/plugins/buddypress/bp-core/classes/class-bp-attachment-avatar.php(261): bp_core_delete_existing_avatar(Array)
    #1 wp-content/plugins/buddypress/bp-core/bp-core-avatars.php(1234): BP_Attachment_Avatar->crop(Array)
    #2 wp-content/plugins/buddypress/bp-core/bp-core-avatars.php(1345): bp_core_avatar_handle_crop(Array)
    #3 wp-includes/class-wp-hook.php(287): bp_avatar_ajax_set(”)
    #4 wp-includes/class-wp-hook.php(311): WP_Hook->a in wp-content/plugins/buddypress/bp-core/bp-core-avatars.php on line 760

    zloro
    Participant

    IN all cases (Delete/Crop for User/Group) javascript console reports:
    jquery.js?ver=1.12.4-wp:4 POST https://xn--i-0i3s.ml/wp-admin/admin-ajax.php 500 (Internal Server Error)
    send @ jquery.js?ver=1.12.4-wp:4
    ajax @ jquery.js?ver=1.12.4-wp:4
    (anonymous) @ wp-util.min.js?ver=5.5.3:2
    Deferred @ jquery.js?ver=1.12.4-wp:2
    send @ wp-util.min.js?ver=5.5.3:2
    post @ wp-util.min.js?ver=5.5.3:2
    setAvatar @ avatar.min.js?ver=6.3.0:1
    cropAvatar @ avatar.min.js?ver=6.3.0:1
    dispatch @ jquery.js?ver=1.12.4-wp:3
    r.handle @ jquery.js?ver=1.12.4-wp:3

    zloro
    Participant

    Hello. Brand new install of WP 5.5.3 and BuddyPress 6.3.0 on a server running MySQL Version
    5.6.32 & PHP Version 7.4.10 with NO OTHER plugins active & running on 2020 template.

    On Page: https://www.rolevant.com/members/rolevantist/profile/change-avatar/

    I can upload the image and am given the option to crop the uploaded image. However, once I select my crop area and I press the crop button the <upload & crop> area disappears & a red box WITH NO MESSAGE appears. Nothing else happens.

    The original files are being uploaded to
    https://rolevant.com/wp-content/uploads/avatars/1/&#8230;

    But no automatically resized or manually cropped images are being saved anywhere.

    Other similar Avatar Crop issues from 8-10 years ago exist on this forum, but nothing that is applicable to these latest versions. Any & all fixes (incompatable javascipt, JQuery, AJAX version incompatibility with JQUERY/AJAx versions called by templates) are just not relevant here. Please Help!!!

    #315479
    evo252
    Participant

    Hi!
    Is there a PHP function or anything else to skip the cropping step of avatar after uploading a photo? A way to crop automatically the avatar for instance?
    Because the cropping step is not useful, especially on smartphones.
    Thanks!

    #315446

    In reply to: Group Cover Image

    Varun Dubey
    Participant

    You can change the default crop dimension for the cover images https://codex.buddypress.org/themes/buddypress-cover-images/

    #313632
    Engine44
    Participant

    When you upload a Group Cover Image, should you then see an option to crop or adjust the image? Thanks.

    #313410
    tom1916
    Participant

    Hi everyone, I have some problem with crop avatar image in mobile. Its work fine in desktop but in mobile when I upload wide photo it is bigger than the phone screen.

    I’m using a SweetDate theme.

    #312699

    In reply to: Cant Crop User Avatar

    amaclenan
    Participant

    UPDATE: I deactivated the A3 Lazy Load plugin and the cropping has started working!! 🙂

    How do we log this for other users?

    #312697
    amaclenan
    Participant

    I see many people seem to have this problem and the site I am writing for a client certainly does – when a user loads a new Avatar picture, the result is a tiny dot and it is impossible to crop.

    This is a deal-breaker for using BuddyPress – does anyone have a work around?

    I am using Avada theme but have tested it with 2020 and still no luck.

    benhutchenspearson
    Participant

    Hi All,

    Not sure if anyone can help with this. I have spotted a bug when uploading avatar. Upload works fine, crop works fine. When clicking crop image, I then get a red error bar with no explanation. When using the console in Chrome it points to a 500 server error. When looking at network it seems to be an issue with the following file wp-admin/admin-ajax.php.

    I have no idea where to look for the error here. I should add that I am using Youzer in combination with BP 6.0 and the developers at Youzer only support up to 5.2, which is not helpful. Also, the avatar does upload fine but you do not receive a message saying avatar successfully changed or words

    I have FTP access but annoyingly not to wp-admin folder as it’s hosted by wordpress. Any pointers greatly appreciated on where I can look/grab code from to help decode this error further.

    Thanks

    Ben

    #312059
    Kookidooki
    Participant

    I got recurrent problems with cropping images. First it worked normally amd all of a sudden when – for example when I replace an existing avatar with a new one – the cropping fails and keeps failing.

    Status:
    Using latest WP and Buddypress.
    Did not make changes or installed new plugins, etc.
    Upload is normal. Cropping fails.
    GD Library is installed and orking normal.
    Lazy loading is not installed or active.

    Is there a permanent fix. I’ve been searching for this since a couple of days and still to no avail.

    Thx

    jksastrology
    Participant

    Hello,

    Can anyone please tell me how to change the Avator cropping image size?

    It works OK on larger devices. However, on mobile devices the uploaded image that you want to crop is way too big for the screen. CSS modifications do not seem effective at resizing the image during the cropping stage.

    Any help is much appreciated.

    Jay

    laschwi
    Participant

    Hello,
    I would need some Help with my Website. I have installed Buddypress and Bbpress to create a cool forum, however when I tried to upload a Profilpicture I cannot crop it, it appears as a little point on the side. I can only save it and the picture appears croped as Profil picture, but not like I wanted to have it.
    I am using the Theme : Dyad 2
    Can someone help me? that would be great!

    My Website: https://aybidahlson.com

    Kookidooki
    Participant

    Hello guys,

    I’m using the latest WP and Buddypress version for a new site. During testing we’ve encountered some problems:

    1. Cannot crop and upload avatars.
    2. Cannot upload images => it’s throwing http error.

    I’ve never seen this kind of problem before on other (older) buddypress and wordpress installs. We’re still using the same server.

    I did some search and some saying it’s a GD-library problem that’s not installed (?).

    What exactly is the problem and how can we fix this?

    Thank you for your time.

    #310626
    faizel93
    Participant

    I have a problème regarding the upload of an image on the profile page.
    The image does not appear fully and I cannot crop it.
    See the image attached : https://ibb.co/7RZHFjL

    Any help ?

    I’m using Buddypress 5.1.2
    My Template : Sweedate

    #310418
    chshaheryar
    Participant

    Hi Everyone,

    I am facing the same issue and cropping is not working.
    Once user uploads the picture it comes as a tiny block on the top left as highlighted in the below screenshot.

    Image Croping Issue Screenshot

    Did anyone found a fix for this issue?

    I am using…
    Wordpress Version: 5.3.2
    PHP: 7.1
    Buddy Press: 5.1.2

    #310305
    ximaan
    Participant

    Hi everyone,

    So I have a very annoying issue with avatars in buddypress. Basically when I try to test and upload a new avatar, it crops it in a very weird way. This is for every single avatar. I even tried changing the dimensions with coding, but this still keeps happening. It just crops a specific part of the photo. Please see my screenshot here. I have no idea how to fix this. My website is glowgettersguide.com. My theme is sausalito.

    Here is my screenshot and what happens when I upload any size photo even a small one: https://imgur.com/a/SifYLmp

    Please help. Thanks a lot!

Viewing 25 results - 51 through 75 (of 1,245 total)
Skip to toolbar