Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Friendesha

    (@friendesha)

    Response from their team:

    Hello Rob,

    The image filter works through a two step process.

    After you submit the URL of the image to the service, XML is returned with a unique ID for the image.

    that will look like so:

    <?xml version=”1.0″ encoding=”utf-8″ ?>

    <rsp stat=”ok”>
    <method>webpurify.live.imgcheck</method>
    <format>rest</format>
    <imgid>7de93bc200ff21a26da6ddb115506e82</imgid>
    <status>pending</status>

    <api_key>f3412a9614845dc17d97a5d51a647a13</api_key>
    </rsp>

    Once the image is moderated (which can take between 2 and 5 minutes)

    Our service makes a request to a script you will have to host. Our request is a GET that have two arguments “status” and “imgid”

    The imgid will be the ID we return to you after step 1.

    The status, the result will be:

    status = 1 means the image has been approved and is clear of adult content
    status = 2 means the image has been declined and contains adult content.

    So, your code and database will have to store the image id and only allow the image to be displayed on your site once the image has been returned a status of 1.

    I hope this helps,

    Please let us know if you have any questions.

    Sincerely,

    WP Support

    Thread Starter Friendesha

    (@friendesha)

    So after some trial and error I havent had much progress. All I know is that I need to find where WP or BP get the uploaded image. I am looking for this type of flow…

    1. User selects image to upload and clicks upload.
    2. Image is uploaded.
    3. Image Filter request is sent to WebPurify with Image URL.
    4. Image is either approved or denied.
    4a. If approved the user sees the “Crop Avatar” page.
    4b. If denied the user sees an error to upload a different image.

    That is the basics of it. Its my hope that I can get this to work over the next couple days, but I am definitely going to need help figuring out how WordPress uploads images, and how to integrate this into those functions.

    Here is my example plugin code so far (I know its not correct):

    add_action( 'bp_init', 'bp_wpurifyimg_init' );
    
    function WebPurifyImgReplace($file) {
        global $wpdb;
    
       	$imgurl = ('bp_avatar_to_crop_src()');
    
        $params = array(
          'api_key' => 'XXXXXXXXXXXXXXXXX',
          'method' => 'webpurify.live.imgcheck',
    	  'imgurl' => $imgurl(''),
        );
    
        $encoded_params = array();
        foreach ($params as $k => $v){
            $encoded_params[] = urlencode($k).'='.urlencode($v);
        }
    
    #
    # call the API and decode the response
    #
        $url = "https://www.webpurify.com/services/rest/?".implode('&', $encoded_params);
    
        $response = simplexml_load_file($checkurl,'SimpleXMLElement', LIBXML_NOCDATA);
    	var_dump($response);
    	$response = $imgurl;
    
    }
    
    function bp_wpurifyimg_init() {
    	add_action('bp_avatar_upload','WebPurifyImgReplace');}

    Thanks for any help in advance!

Viewing 2 replies - 1 through 2 (of 2 total)