Loading and Referencing Images


I’m slowly writing a page to manage an asset database; effectively, writing a very basic plugin. I want to import photos and found some excellent examples of how to do this and, made it work! My problem then was to display the images in the page. Although I know the uploaded image filename, there seems to be no way to use it. The image will be put into the current ‘date’ folder and could well be renamed on the way. I’ve ended up querying the last post ID just before I import the image and adding 1 to it to reference the image. With the post ID I can then use wp_get_attachment_image_src to get a url for the (resized) image: wp_get_attachment_image_src( $result->PostNum, ‘medium_large’ )
It works but it is very clunky. Is there a better way of doing this?


, Ian Turner 3 years 2020-07-04T12:11:11-05:00 0 Answers 66 views 0

Leave an answer