Jump to content

Removing Characters From a string


seran128

Recommended Posts

I have a table that holds the path to a file

home/myname/public_html/site1/Images/bbd61948840809e5a0d83b3cf21bdd47.png

What I want to do is cut the
home/myname/public_html/site1/Images/


My code that gets the results is

<td colspan="2" class="Results" ><img src="<? echo $info[0]['ImagePath1'] ?>"></td>

and this returns
a broken image and the properties of that image is

http://mydomain.com/home/myname/public_html/site1/Images/bbd61948840809e5a0d83b3cf21bdd47.png
Link to comment
https://forums.phpfreaks.com/topic/28765-removing-characters-from-a-string/
Share on other sites

If it's the same all the time (the part you want to remove) you can do something like this:

[code]<?php

//$path holds the full path (IE "home/myname....fhed.png")
$len = strlen("home/myname/public_html/site1/Images/");
$file_name=substr($path,$len);
echo $file_name;

?>[/code]

Orio.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.