nxs_chckRmImage

The NextScripts: Social Networks Auto-Poster nxs chckRmImage function.

Description

nxs_chckRmImage( $url, (string) $chType = 'head' ); 

Parameters (2)

0. $url
The url.
1. $chtype (string)
The chtype.

Usage

  1. if ( !function_exists( 'nxs_chckRmImage' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'nextscripts-social-networks-auto-poster/nxs_functions.php'; 
  3.  
  4. // The url. 
  5. $url = null; 
  6.  
  7. // The chtype. 
  8. $chtype = ''; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = nxs_chckRmImage($url, $chtype); 
  12.  

Defined (1)

The function is defined in the following location(s).

/nxs_functions.php  
  1. if (!function_exists('nxs_chckRmImage')) {function nxs_chckRmImage($url, $chType='head') { if( ini_get('allow_url_fopen')=='1' && @getimagesize($url)!==false) return true; 
  2. $hdrsArr = nxs_getNXSHeaders(); $nxsWPRemWhat = 'wp_remote_'.$chType; $rsp = $nxsWPRemWhat($url, array('headers' => $hdrsArr));  
  3. if(is_wp_error($rsp)) { nxs_addToLogN('E', 'Error', 'IMAGE', '-=ERROR=- Server can\'t access it\'s own images. (Image URL: '.$url.') Most probably it\'s a DNS problem. Please contact your hosting provider. '.serialize($rsp), ''); return false; } 
  4. if (is_array($rsp) && ($rsp['response']['code']=='200' || ( $rsp['response']['code']=='403' && $rsp['headers']['server']=='cloudflare-nginx') )) return true;  
  5. else { if ($chType=='head') { return nxs_chckRmImage($url, 'get'); } else { nxs_addToLogN('E', 'Error', 'IMAGE', '-=ERROR=- Server can\'t access it\'s own images. (Image URL: '.$url.') Most probably it\'s a DNS problem. Please contact your hosting provider. '.serialize($rsp), $url); return false; } 
  6. }  
  7. }}