inkthemes_get_image

This function gets image width and height and Prints attached images from the post.

Description

inkthemes_get_image( $width, $height ); 

Parameters (2)

0. $width
The width.
1. $height
The height.

Usage

  1. if ( !function_exists( 'inkthemes_get_image' ) ) { 
  2. require_once '/functions/inkthemes-functions.php'; 
  3.  
  4. // The width. 
  5. $width = null; 
  6.  
  7. // The height. 
  8. $height = null; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = inkthemes_get_image($width, $height); 
  12.  

Defined (1)

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

/functions/inkthemes-functions.php  
  1. function inkthemes_get_image($width, $height) { 
  2. $w = $width; 
  3. $h = $height; 
  4. global $post, $posts; 
  5. //This is required to set to Null 
  6. $img_source = ''; 
  7. $id = ''; 
  8. $permalink = get_permalink(); 
  9. ob_start(); 
  10. ob_end_clean(); 
  11. $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches); 
  12. if (isset($matches [1] [0])) { 
  13. $img_source = $matches [1] [0]; 
  14. if ($img_source) { 
  15. print "<div class='post-image'><a href='$permalink'><span></span></a><img height='$h' width='$w' src='$img_path[url]' class='postimg' alt='Post Image'/></div>";