generateimageremote

Create attachment from remote image.

Description

(int) generateimageremote( (string) $url, (int) $postid = 0 ); 

Returns (int)

attachment ID

Parameters (2)

0. $url (string)
Remote image url
1. $postid — Optional. (int)
ID of the post to assign attachment to

Usage

  1. if ( !function_exists( 'generateimageremote' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'google-books-importer/inc/functions.php'; 
  3.  
  4. // remote image url 
  5. $url = ''; 
  6.  
  7. // ID of the post to assign attachment to 
  8. $postid = -1; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = generateimageremote($url, $postid); 
  12.  

Defined (1)

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

/inc/functions.php