Pete Posted September 24, 2011 Share Posted September 24, 2011 Here's a question I've been meaning to ask for a while. I'm going to have a few pages where there will be a number of images uploaded to it. Some of the images will be inserted throughout the content in the body field, however there are going to be a few occasions where there will be some images "left over", so ones not used in the body field. What I'd like to do on some pages is be able to output these in my template after the body content. So my question therefore is, is there an easy way to output only those images that are "left over"? For those that are curious, the context in this case is gaming articles where I sometimes get given 20 images or so and I place some in the page content in relevant positions and have the rest as "More Screenshots". (Of course, an easier way would be to move the left over ones to a different image field, but I was thinking their may be a relatively easy solution to using just one image field). Link to comment Share on other sites More sharing options...
ryan Posted September 24, 2011 Share Posted September 24, 2011 Foreach your images and strpos the URL for each one in your body field. When it matches, remove the image from the array. You'll be left with the unused ones. I can post a code sample when I'm back at the computer on Monday if you'd like? Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now