WordPress.org

Forums

Image Watermark
[resolved] Apply watermark on frontend uploads (12 posts)

  1. Hassan
    Member
    Posted 2 years ago #

    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?

    http://wordpress.org/extend/plugins/image-watermark/

  2. dFactory
    Member
    Plugin Author

    Posted 2 years ago #

    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.

  3. Hassan
    Member
    Posted 2 years ago #

    I'm gonna have to check with CRED devs and follow up with you...
    brb :)

  4. quentinn
    Member
    Posted 2 years ago #

    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

  5. dFactory
    Member
    Plugin Author

    Posted 2 years ago #

    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).

  6. Hassan
    Member
    Posted 2 years ago #

    Hi,

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

  7. quentinn
    Member
    Posted 2 years ago #

    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 :)

  8. dFactory
    Member
    Plugin Author

    Posted 2 years ago #

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

  9. Hassan
    Member
    Posted 2 years ago #

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

  10. slipnox
    Member
    Posted 1 year ago #

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

    Thanks

  11. dFactory
    Member
    Plugin Author

    Posted 1 year ago #

    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.

  12. Hassan
    Member
    Posted 1 year ago #

    IT WORKS! :D

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Image Watermark
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic