In your post you wrote : “which will show an image like below”, I assume that your shortcode return an img
tag and you have to find your URL here, tell me if I’m wrong.
Using DOMDocument
http://php.net/manual/fr/class.domdocument.php to parse your img
tag is a good idea.
$img = do_shortcode('[user_meta_avatar_pic]'); // Here your get your img tag
// Use DOMDocument to parse your img tag
$dom = new DOMDocument();
$dom->loadHTML($img);
$img_url = base64_encode($dom->getElementsByTagName('img')->item(0)->getAttribute('src')); // Encode the extracted src from your img tag
You can also use regex, I have no idea about performances comparison beetween a regex and DOMDocument
.
Related Posts:
- Remove images from get_the_excerpt
- Redirect to another page using contact form 7? [closed]
- Visual Composer creating own shortcodes with vc_map() to return simple Image
- how can I change all wordpress media file url to custom cdn url?
- Using Switch Statement to Change Image According to Last Digit of Topic ID
- Add image size if page template
- Custom page with variables in url. Nice url with add_rewrite_rule
- remove links from images using functions.php
- Removing default image size list in Media Box
- How to display random users with avatars
- How to create thumbnails for PDF uploads?
- Creating a table from shortcode avoiding wpautop for each row
- Stripping shortcode from custom excerpt function
- Why are image thumbnails cropped proportionally (not per dimensions)?
- Formatting post content to exclude gallery
- Gallery images titles – get from post
- Shortcode with custom content attribute?
- Shortcode to insert menu in page body?
- How can I rename the WordPress AJAX URL? [duplicate]
- How to add a rel attribute to images that contains their categories?
- Why are image thumbnails cropped proportionally (not per dimensions)?
- Passing HTML in WordPress Shortcode arguments
- Best way to programatically add “rel” attributes to page and post images
- Custom Shortcode, functions PHP WP_Query loop
- Super simple shortcode not working
- Display gallery on top before content
- How can you limit srcset on a single type of page?
- How to extract the variables out from “add_shortcode” function?
- How to get specified parent page title in my function
- Possible to display shortcode based on the category?
- Overwriting Parent Theme’s Image Sizes
- Image rotation fails to regenerate custom sized thumbnail
- Display post shortcode content in the sidebar?
- Twentyten Child Theme: header images display messed up in admin panel
- How to get the index number of the posts?
- Using shortcode content with nested shortcode
- Removing custom meta data
- How to filter $content in shortcode function
- Set spesific size of featured images
- Scrape external webpage for first image and add it to new post
- Display gallery on bottom after content
- media resize/crop possibilities?
- Excerpts are not displayed by a shortcode on category pages
- WordPress Shortcode function display outside of widget
- check if the user is owner of current page
- shortcode help require
- Use html inside shortcode function
- Get arguments from URL
- Way to store featured image width and height in two separate variables?
- Limit dimensions of “Full” size images
- Function shortcode – Set Parameter
- Add unique id to Preview URL
- Using multiple line variable inside a function?
- How to echo the value of an array element using a function via a shortcode
- Wp-query Order By problem
- Need To Change WordPress Meta Tags… Includes wordpress shortcodes
- How to create shortcode with html and php content?
- Shortcode question
- Protect get_query_var from manual input in url
- Problem with images URL after filter applying
- Shortcode to get featured image of specific id post
- Modify shortcode to work with custom post types
- Using add_image_size in functions.php to get original uploaded file
- show all the posts thumbnails
- Problem with shortcode inside a shortcode
- Need help making a short code work
- Custom image sizes showing in Classic Editor only when upladed directly to post
- Display a list of random terms from custom taxonomy with shortcode
- Load templates, pass arguments, and render output from functions.php
- How to change images url in function.php?
- reWrite wp-content url to point on my cdn
- How to Override Page Template if URL matches query?
- Probleme shortcode with list author
- Last updated posts shortcode in functions.php
- Add #primary at the end of navlink permalinks on single posts
- Shortcode to output category description by passing ID
- Help using ShortCodes to style whole chunks of the post
- Need to Echo A Url path to show on a wordpress page
- Printing medium sized image
- HowTo: Add wrapper to columns shortcode?
- Why am I losing image quality on my site?
- Replace image attributes for lazyload plugin on image elements with specific class
- Shortcode Function – Can’t get anything else to return after running shortcode within shortcode
- Custom shortcode with do_shortcode and substr
- No compression occurs on my jpegs after adding jpeg_quality hook to my functions.php file
- Can I use a function to return HTML and the result of another function?
- Update add_image_size
- Function the_content
- Expanding a function to call a plugin or show a link
- Trying to the deduce shortcode from a function
- Dynamically adding Captions to images
- Full size image option removing problem
- Run function from parent on child site
- Shortcode Variations?
- Whats wrong with my code? Need To add String to shortcode? [closed]
- Custom shortcode not being included in content paragraph [duplicate]
- Image width issue in IE [closed]
- Creating mixture of shortcodes to use in the visual/text editor
- PHP error in shortcode [closed]
- multible shortcodes (for differnt values) with one function