Jump to content

[SOLVED] spaces in image names


SchweppesAle

Recommended Posts

actually, there are sometimes multiple images. 

 

The database itself is part of a Joomla 1.5 CMS.  Usually, images are stored with the following format

 

<img align="left" width="209" src="../images/stories/intuit logo new for 2008.jpg" height="90" />

 

They're in there with the actual content though, so I'm not really sure how to get in there and modify only the required src = "" string

Link to comment
Share on other sites

Since the request was for regex, I moved the thread to the regex board. Please note this board for future regex requests.

 

Database issues not withstanding, if going the regex route, is this something along the lines of what you are looking for?

 

$str = 'img align="left" width="209" src="../images/stories/intuit logo new for 2008.jpg" height="90" />';
if(preg_match_all('#src=[\'"][^\'"]+[\'"]#i', $str, $matches)){
foreach($matches[0] as $val){
	$str = str_replace($val, str_replace(' ',"%20",$val), $str);
}
}
echo $str; // ouputs: img align="left" width="209" src="../images/stories/intuit%20logo%20new%20for%202008.jpg" height="90" />

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.