WC Lovers

WooCommerce Frontend Manager - Multivendor marketplace vendor dashboard

We're shifting our Forum based support to a more dedicated support system!

We'll be closing our Forum support from 10th June, 2020 and move to Email Support assistance.

  • If you are a WCFM premium add-ons user, contact us- here
  • Want to know more before buying our add-ons? Send Pre sale queries- here
  • If you are a WCFM free user, please open a support ticket at WordPress.org
  • For WCFM App related queries, reach us- here
From now the forum will be read-only!

Forum Replies Created

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • in reply to: Add_filter on image upload only for product image #128538
    catou67
    Participant

    Hi,

    I add a meta_key to user meta table. I know that my solution has limits, but considering my vendors it’s suffisant at this time.
    I will try to do better if the need arises.

    Thank you for your help

    in reply to: Add_filter on image upload only for product image #128130
    catou67
    Participant

    Hi,
    I have solved my problem.
    In fact I have written a java/php function associated to each “load media” instance (onclick). This function stores a flag in the database.
    Flag which is tested when an upload image is done. So I know if the filter has to be applied.
    It’s work fine .

    Regards

    in reply to: Add_filter on image upload only for product image #126407
    catou67
    Participant

    Thank’s for your response, I understand that this subject is not simple, I have spent somme hours with no success
    Sorry to have disturbed you.
    Bravo for the great job you do to help us
    Regards

    in reply to: Add_filter on image upload only for product image #126226
    catou67
    Participant

    Hi,

    I still search a solution to my problem. With no success after few hours !
    I have written a filter (added to wp_handle_upload) which modify the uploaded image to keep the full original image into a square 500*500.
    It’s work fine, image is not streched but blank area is added on top/buttom or left/right if the original imag is not a square image.
    The filter is applied only in wcfm_edit_product
    BUT
    It is fine when I load the picture of the product but the same filter is done whe an image is uplaoded in the short or long description

    I don’t find how to distinguish these 2 ways

    Any idea ??

    Thank’s for help I am near the target

    in reply to: Add_filter on image upload only for product image #124830
    catou67
    Participant

    Hi,

    Thanks for your quick answer. It work’s “quite” well,

    I would like to apply my filter only when I load a product image not when I add a media to a post.

    How can I distinguish this 2 ways ?
    There is certainly a way to do it : into the view select image the button to select the picture is
    For a product image : “select”
    For a media : “insert into product”

    Thank’s for help

    Attachments:
    You must be logged in to view attached files.
    in reply to: Add_filter on image upload only for product image #124095
    catou67
    Participant

    Hi,
    Thanks for your answer.

    My target is to build a square image for each product, including the FULL ORIGINAL image, that with adding blanck part on width or height.
    No problem to write this code, my problem is to not apply this code to any uploaded image, but only for products image.

    I add add_filter on ‘wp_handle_upload’ : that is ok

    add_filter(‘wp_handle_upload’, ‘cdpro_resize_image’, 10, 2 );

    function cdpro_resize_image( $array, $context ) {

    if ( I would like to apply this filter only on product image upload ) {

    $ok = array( ‘image/jpeg’, ‘image/gif’, ‘image/png’ );
    if ( ! in_array( $array[‘type’], $ok ) ) return $array;

    $im = imagecreatefromjpeg($array[‘file’]);
    $text_color = imagecolorallocate($im, 233, 14, 91);
    imagestring($im, 4, 5, 5, ‘Some text’ , $text_color);
    imagejpeg($im, $array[‘file’]);

    // Libération de la mémoire
    imagedestroy($im);

    }
    return $array;

    }

    Thank’s for help

Viewing 6 posts - 1 through 6 (of 6 total)