Good question there! I think the question itself is: which datatype holds the picture? If it's from a Media Picker datatype it should be easy to check if the datatype holds an image.
However, if the image is present in the RTE datatype, I think you will need some sort of parsing/search in the bodyText (or whatever the datatype is called) field to look for "/media/x.ext" :-)
Also, if the workflow is the following: "When a user clicks an image in the Media section, it displays a list of documents where the clicked image is present" you should definately look into writing your own datatype to do the parsing and/or Media Picker check.
Another option would be to hook into the Document published event and create a relation, using the Relationship API, between the document and the image (if theres one selected) This way you only need to look at one document/nodes (the one being published) bodyText if there's any images present instead of iterating through all documents. You're then able to get all Media-to-Document relations for a given image which gives you a list of nodeIds of the related documents.
Hope the above makes sence. If not, let me know and I'll try to elaborate on it :-)
List where an image in the media section is used in content
Is there a way to see where an image in the media section has been used in the main site / content?
A client wants to be able to view and image and see which pages it has been used on
Thanks in advance...
Hi Paul,
Good question there! I think the question itself is: which datatype holds the picture? If it's from a Media Picker datatype it should be easy to check if the datatype holds an image.
However, if the image is present in the RTE datatype, I think you will need some sort of parsing/search in the bodyText (or whatever the datatype is called) field to look for "/media/x.ext" :-)
All the best,
Bo
Also, if the workflow is the following: "When a user clicks an image in the Media section, it displays a list of documents where the clicked image is present" you should definately look into writing your own datatype to do the parsing and/or Media Picker check.
Another option would be to hook into the Document published event and create a relation, using the Relationship API, between the document and the image (if theres one selected) This way you only need to look at one document/nodes (the one being published) bodyText if there's any images present instead of iterating through all documents. You're then able to get all Media-to-Document relations for a given image which gives you a list of nodeIds of the related documents.
Hope the above makes sence. If not, let me know and I'll try to elaborate on it :-)
/ Bo
Hi,
Might be worth to check the media link checker package
Cheers,
Richard
That right there will be your solution ;)
Thanks for pointing that one out, Richard! Will def. use that package whenever needed.
Hi Richard - that package did the trick!
Cheers!
is working on a reply...