mark_nsx Posted August 6, 2008 Share Posted August 6, 2008 hi guys i need your help. basically i need to grab all image tags and modify its source by replacing multiple "../../../" with two "../../" eg. <img src="../../ .." /> cheers! Link to comment https://forums.phpfreaks.com/topic/118380-image-tag-matching/ Share on other sites More sharing options...
secoxxx Posted August 6, 2008 Share Posted August 6, 2008 What are you using to edit your code? Link to comment https://forums.phpfreaks.com/topic/118380-image-tag-matching/#findComment-609304 Share on other sites More sharing options...
mark_nsx Posted August 6, 2008 Author Share Posted August 6, 2008 dreamweaver hehe. Link to comment https://forums.phpfreaks.com/topic/118380-image-tag-matching/#findComment-609310 Share on other sites More sharing options...
secoxxx Posted August 6, 2008 Share Posted August 6, 2008 Edit > Find and Replace in the find box do ../../../ or <img src="../../../ in the replace box do ../../ or <img src="../../ then hit the Find next button, when you come across the imag tags src ones hit replace, then find next again, this is just incase you have others with ../../../ you want to keep. if not, Replace all. Link to comment https://forums.phpfreaks.com/topic/118380-image-tag-matching/#findComment-609315 Share on other sites More sharing options...
mark_nsx Posted August 6, 2008 Author Share Posted August 6, 2008 sorry my description wasn't clear..i have to implement this in php for my dynamic code.. Link to comment https://forums.phpfreaks.com/topic/118380-image-tag-matching/#findComment-609319 Share on other sites More sharing options...
secoxxx Posted August 6, 2008 Share Posted August 6, 2008 is the ../../../ in the database or somthing? Link to comment https://forums.phpfreaks.com/topic/118380-image-tag-matching/#findComment-609320 Share on other sites More sharing options...
mark_nsx Posted August 6, 2008 Author Share Posted August 6, 2008 its the output of tinyMCE editor. for some reason it changes the source of the images inserted to it when i submit the form. Link to comment https://forums.phpfreaks.com/topic/118380-image-tag-matching/#findComment-609326 Share on other sites More sharing options...
secoxxx Posted August 6, 2008 Share Posted August 6, 2008 hmm, maybe try a different wysiwyg editor and see if that fixes it. Link to comment https://forums.phpfreaks.com/topic/118380-image-tag-matching/#findComment-609331 Share on other sites More sharing options...
discomatt Posted August 7, 2008 Share Posted August 7, 2008 You could use regex. $subject = preg_replace( '%(?:\\.\\./){3,}+%', '../../', $subject ); Will replace 3 or more '../' with '../../' Link to comment https://forums.phpfreaks.com/topic/118380-image-tag-matching/#findComment-610286 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.