如何从已编辑的变量加载图像?

问题描述:

Hello and sorry for the noobie question
Let's say i have a variable with value url

<input type="text" name="link">

Which submits the following link :

domain.com/profile/deCKfkiriCJFff 

Since the link above is not a valid img src i would like to display an image with the same source but with one slight change :

domain.com/profile/images/deCKfkiriCJFff 

^ valid image link

对于noobie问题,您好抱歉
我说我有一个值为url的变量 p>

 &lt; input type =“text”name =“link”&gt; 
  code>  pre> 
 
 

提交以下链接: p>

  domain.com/profile/deCKfkiriCJFff 
  code>  pre> 
 
 

由于上面的链接不是有效的img src,我想 显示具有相同来源但略有改变的图像: p>

  domain.com/profile/images/deCKfkiriCJFff 
  code>  pre> 
 
  

^有效图片链接 p> div>

Use explode

$domain = 'domain.com/profile/deCKfkiriCJFff';
$exploded = explode('profile', $domain);
$validUrl =  $exploded[0].'profile/images'.$exploded[1];
echo $validUrl;