Jump to content

Image Path Question


unemployment

Recommended Posts

How can I make the image path not have the starting slash for the $path?

 

Currently this...

function getUserAvatar($username)
{
if (file_exists("{$GLOBALS['path']}/img/${username}.png"))
{
	return "/assets/img/${username}.png";
}
else
{
	return "/assets/img/defaultuser.jpg";
}
}

 

When path is executed I need it to make

 

/assets/

 

be

 

assets/

 

I need to remove the first character from the $path variable.

 

if ($type === 'image/png'){ imagepng($this->img, $path); }

Link to comment
https://forums.phpfreaks.com/topic/233937-image-path-question/
Share on other sites

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.