• Resolved Hassan

    (@hassanhamm)


    I am using a forms plugin called CRED that lets me create posts with frontend forms. There is a image upload field within my form that is used to generate the featured image of the post, but these images don’t get auto-watermarked. Is it possible to apply automatic watermarking there? How does this plugin apply watermarks anyway? I mean, in developer lang, what are you hooking to?

    https://www.ads-software.com/extend/plugins/image-watermark/

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author dFactory

    (@dfactory)

    Hi Hassan,

    At least from my private tests it looks like Image Watermark will work with any frontend upload plugins and scripts if it is using default WordPress media upload functions (for example media_handle_upload). Question is does CRED use it? If not, what is the upload process it follows and does it offer any API to hook into.

    Thread Starter Hassan

    (@hassanhamm)

    I’m gonna have to check with CRED devs and follow up with you…
    brb ??

    Thanks for the perfect plugin.
    As a matter of fact I have the same problem with my images uploaded from the frontend with my custom script (even if it uses the WordPress core functions to upload) => there is no watermark added after the post submit.

    Here is the input field :
    <input type="file" name="image[]" id="image"><span class="help-inline">Max up size: 10m</span>

    Here is the function I use (on a page on the frontend) :

    function insert_attachment($file_handler,$post_id,$setthumb='false') {
    	// check to make sure its a successful upload
    	if ($_FILES[$file_handler]['error'] !== UPLOAD_ERR_OK) __return_false();
    
    	require_once(ABSPATH . "wp-admin" . '/includes/image.php');
    	require_once(ABSPATH . "wp-admin" . '/includes/file.php');
    	require_once(ABSPATH . "wp-admin" . '/includes/media.php');
    
    	$attach_id = media_handle_upload( $file_handler, $post_id );
    
    	if (isset($setthumb)) update_post_meta($post_id,'_thumbnail_id',$attach_id);
    	return $attach_id;
    }

    Do I have to insert a call to wp_generate_attachment_metadata as you apply the watermark within thius function ?

    add_filter('wp_generate_attachment_metadata', array(&$this, 'apply_watermark'));

    Thanks for your advice

    Plugin Author dFactory

    (@dfactory)

    I think it should work with your function.

    What are your watermark settings? Do you have automatic watermark enabled? Do you have enabled watermarking during any image upload or on selected post types only? (it should be set to any).

    Thread Starter Hassan

    (@hassanhamm)

    Hi,

    So, this is how CRED handles uploads. It uses the wp_handle_upload function. Is this code compatible? Currently, watermarks are not applied.

    Thanks for this answer.
    Sorry for the delay, holidays etc…

    I’ve checked the parameters and both options are turned on and still it does not work even with the recent update ??

    Plugin Author dFactory

    (@dfactory)

    Ok, looks like we need to work on it (we’ll install CRED and try to make our plugin compatible with it.)

    Thread Starter Hassan

    (@hassanhamm)

    Great news! We’re here if you need any advice.

    Same issue here, but with Frontend Uploader plugin, any solutions yet?

    Thanks

    Plugin Author dFactory

    (@dfactory)

    A new version has just been released. It works for Frontend Uploader, should work for CRED and other plugins using WP upload methods.

    Just activate the Automatic frontend watermarking option in plugin settings.

    Thread Starter Hassan

    (@hassanhamm)

    IT WORKS! ??

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Apply watermark on frontend uploads’ is closed to new replies.