可以通过插入实际的URL为我的images-directory-path定义一个常量吗?

I want to define a constant for my images directory path by inserting the actual URL.

For example:

define("IMAGES_PATH", "http://example.com/images/");

Then I could link all my images dynamically from a database without having to know which subdirectory I am currently working in.

Then i will link to the image like this:

<img src="<?php echo IMAGES_PATH . $var; ?> alt="">

For the example i used $var = example.jpg as would be the result from the database.

So, Is this a legitimate way to do this?