Forum Replies Created
- AuthorPosts
- catou67Participant
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
catou67ParticipantHi,
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
catou67ParticipantThank’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
Regardscatou67ParticipantHi,
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 descriptionI don’t find how to distinguish these 2 ways
Any idea ??
Thank’s for help I am near the target
catou67ParticipantHi,
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.catou67ParticipantHi,
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
- AuthorPosts