Ok I found the answer that no one has on the net I been looking for days now.
Here is how I was able to do it. Hope this helps someone out there
// This is getting the image / url
$feature1 = get_theme_mod('feature_image_1');
// This is getting the post id
$feature1_id = attachment_url_to_postid($feature1);
// This is getting the alt text from the image that is set in the media area
$image1_alt = get_post_meta( $feature1_id, '_wp_attachment_image_alt', true );
Markup
<a href="https://wordpress.stackexchange.com/questions/221481/<?php echo $feature1_url; ?>"><img class="img-responsive center-block" src="<?php echo $feature1; ?>" alt="<?php echo $image1_alt; ?>"></a>
Related Posts:
- Theme Customiser Image Control
- SSL: How to make customizer images Protocol Relative in WordPress?
- Problem Cropping Images From WP Customizer
- wp_customize_image_control deprecated add_tab alternative
- Utilise WP_Customize_Image_Control to only show image picker
- 3.5.x Theme Customize: Handling Custom Control Requests
- Set image dimension for WP_Customize_Image_Control images
- How to return responsive images from a sanitize_callback?
- Remove images (files) that were generated when using add_image_size()
- Displaying images from external RSS feeds?
- Why should I use “Organize my uploads into month- and year-based folders” option? (Cons/Pros)
- Which action hook can I use when a featured image has been selected
- Displaying images with relative paths in the editor
- Prevent image upload unless exact size
- Fixing external image urls
- Associate an existing image with a post
- Need help building a filter to edit the output of “image_send_to_editor”
- Image resize with image url
- Preview Image Path in Admin Section
- Get an image from url in front end submission form
- Can images be automatically compressed?
- Adding custom image size to the media image editor
- Add visual editor to Media Edit Screen
- could not upload image in media library
- How to set the width and height rule for featured image
- hardcrop images in gutenberg “latest posts” block
- Get uploaded image path in wordpress by filename
- Use Gravatar as fallback image if no local image is not found
- add the post as canonical for attachment page wordpress
- How to get image ID to use inside wp_read_image_metadata()?
- Retrieving an alt tag from a custom field
- Exclude featured image from gallery in wp-admin
- Large size image breaks template layout
- Replace original image, WP image editor
- Customizing the attachement page to show rest of all images in a gallery from post
- Disable all resizing and compression
- Is it possible to change ‘Link to’ in all images in all articles?
- Importing images results to wrong folder structure
- WP keeps looking up post thumbnail on https even though wp-config says http
- How to post a mosaic of an image gallery instead of the entire gallery inside a post’ [closed]
- using media_sideload_image with a file from theme directory
- wp_get_attachment_image_src() returning incorrect width and height [duplicate]
- Upload image without media-upload [duplicate]
- Tinymce and uploading local pictures
- Time Based change of image
- WordPress shows my picture in admin bar
- Missing background image setting in admin of twenty nineteen
- Using jQuery to automatically add class only to gif images in WordPress database [closed]
- Modify RSS – remove image and add text
- WordPress Image Scaling Quality
- Create a post from every image in my media gallery
- Retrieve Image Attachments Getting Post Thumbnail Image First
- Is there a wordpress filter to edit the markup of inline images?
- Alt text not showing up
- Overwrite add_image_size defined by theme
- Removing Images from a WordPress Post
- Random Image Script Working but Want to Avoid Duplicates
- How to post images on my blog with a pre-defined border
- HTML Img with data:image src gets sanitized in admin?
- Can’t find image to remove
- How to add a custom class to all the images for a page only?
- How to link image in WordPress – Elementor when certain element does not offer that option?
- How can i place featured image after h2
- Custom image size not displaying with wp_get_attachment_image()
- Images getting smashed
- Unset image sizes before images are uploaded
- unsharp thumbnails after uploading image
- How to delete original image file after upload and resize
- Wrap post images with a link, not figure (image_send_to_editor doesn’t work)
- An error has occurred during the upload process in wordpress 5.3.2
- get_the_post_thumbnail() title and alt attributes not displaying
- Access html element in media modal with jQuery
- Jetpack Lazy load images fade in
- add alt text to images loaded from json with media_sideload_image
- How to make image uploads default to full size?
- WordPress images programatically display error
- Image is missing on site homepage
- Load only imagens resized in custom page
- How to see previous –next image option in the theme?
- Put image onto header
- Getting the Select and Crop Functionality Using Custom Fields
- Changing current post image uls with a function
- Display images in template file
- Need help making my homepage blog image smaller than my post image
- Changing image size displayed in wordpress twenty fourteen theme
- How to add multiple images in a page
- Only User Upload image Http Error
- See the all uploaded images of a user as an admin
- Broken Media Library
- wp_get_attachment_image_src() does not return what I want
- Define Folder to save Images
- Wrap a post image with a div if it doesn’t have a caption
- adding images to wordpress pagination?
- Custom filename when pasting an image from clipboard
- WordPress Bootstrap dynamic carousel showing images separately not as carousel
- How to display image ALT under image?
- Faster image upload on mobile [closed]
- WordPress Theme: replace logo image with title site if file doesn´t exist on server
- WordPress update leads to 404 error on admin page and signup. CSS mishap with all plugin related functions
- How to get dimension of Logo and Crest