Home

How would I add an image link to a page with the page title as the image name Classic Sharepoint

%3CLINGO-SUB%20id%3D%22lingo-sub-574863%22%20slang%3D%22en-US%22%3EHow%20would%20I%20add%20an%20image%20link%20to%20a%20page%20with%20the%20page%20title%20as%20the%20image%20name%20Classic%20Sharepoint%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-574863%22%20slang%3D%22en-US%22%3E%3CP%3EHello%20All%2C%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20wanted%20to%20add%20an%20image%20that%20is%20dynamic%20to%20a%20DocSetHomepage.%20I%20want%20the%20Image%20that%20is%20displayed%20in%20the%20webpart%20to%20display%20to%20have%20the%20following%20format%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%2Fteams%2FBase%2FAdmin%2FPhotos%2F(pagetitle).png%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20am%20not%20sure%20if%20I%20am%20just%20burnt%20out%2C%20but%20what%20would%20you%20do%3F%20how%20would%20you%20achieve%20this%3F%20The%20Webparts%20are%20not%20working%20like%20I%20want%20them.%20Even%20after%20using%20a%20page%20Field%20filter%20or%20CQWP.%20So%20the%20next%20thing%20would%20be%20to%20make%20the%20image%20static%20and%20pull%20from%20the%20photo%20library.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-574863%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EDeveloper%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-686853%22%20slang%3D%22en-US%22%3ERe%3A%20How%20would%20I%20add%20an%20image%20link%20to%20a%20page%20with%20the%20page%20title%20as%20the%20image%20name%20Classic%20Sharepoint%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-686853%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F86048%22%20target%3D%22_blank%22%3E%40Robert%20Ohare%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EYou%20could%20add%20a%20Content%20Editor%20Web%20Part%20(CEWP)%20to%20the%20doc%20set%20home%20page.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIn%20that%20web%20part%2C%20grab%20add%20a%20root%20element%2C%20then%20have%20a%20%3CSCRIPT%3E%20where%20you%20grab%20_spPageContextInfo%20to%20get%20your%20title%2C%20then%20build%20your%20%26amp%3Bamp%3Bamp%3Blt%3Bimg%20src%3D%26amp%3Bamp%3Bamp%3Bamp%3B%2339%3B%26amp%3Bamp%3Bamp%3Blt%3BSPAN%26amp%3Bamp%3Bamp%3Bgt%3B%2Fteams%2FBase%2FAdmin%2FPhotos%2F%26amp%3Bamp%3Bamp%3Bamp%3B%2339%3B%20%2B%20title%20%2B%20%26amp%3Bamp%3Bamp%3Bamp%3B%2339%3B.png%26amp%3Bamp%3Bamp%3Bamp%3B%2339%3B%26amp%3Bamp%3Bamp%3Blt%3B%2FSPAN%26amp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Bgt%3B%20from%20there%20and%20inject%20it%20into%20your%20root%20element.%26amp%3Bamp%3Bamp%3Blt%3B%2FP%26amp%3Bamp%3Bamp%3Bgt%3B%26amp%3Bamp%3Bamp%3Blt%3B%2Flingo-body%26amp%3Bamp%3Bamp%3Bgt%3B%3C%2FSCRIPT%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
New Contributor

Hello All, 

 

I wanted to add an image that is dynamic to a DocSetHomepage. I want the Image that is displayed in the webpart to display to have the following format 

 

/teams/Base/Admin/Photos/(pagetitle).png 

 

I am not sure if I am just burnt out, but what would you do? how would you achieve this? The Webparts are not working like I want them. Even after using a page Field filter or CQWP. So the next thing would be to make the image static and pull from the photo library. 

1 Reply
Highlighted

@Robert Ohare 

 

You could add a Content Editor Web Part (CEWP) to the doc set home page.

 

In that web part, grab add a root element, then have a <script> where you grab _spPageContextInfo to get your title, then build your <img src='/teams/Base/Admin/Photos/' + title + '.png'> from there and inject it into your root element.