What are the advantages and disadvantages of storing absolute vs. relative URL addresses in a database for images?

Storing absolute URL addresses in a database for images can make it easier to reference the images from any location, but it can also lead to potential issues if the domain or directory structure changes. On the other hand, storing relative URL addresses can make the application more portable and easier to maintain, but it may require additional logic to construct the full URL when displaying the images.

// Storing relative URL addresses for images in a database
$imagePath = 'images/example.jpg';
```

```php
// Storing absolute URL addresses for images in a database
$imagePath = 'https://www.example.com/images/example.jpg';