# How do you use asset urls?

**URL:** <https://forum.getkirby.com/t/how-do-you-use-asset-urls/5242>\
**Category:** Questions\
**Tags:** v2\
**Created:** [September 13, 2016, 8:16am UTC](https://forum.getkirby.com/t/how-do-you-use-asset-urls/5242 "2016-09-13T08:16:20Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jenstornell](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/jenstornell/32/546_2.png) [@jenstornell](https://forum.getkirby.com/u/jenstornell)\
**Post date:** [September 13, 2016, 8:16am UTC](https://forum.getkirby.com/t/how-do-you-use-asset-urls/5242/1 "2016-09-13T08:16:20Z")

</div>

When having images as assets I usually load them like this:

```html
<img src="<?php echo u() . '/assets/images/image.png'; ?>">

```

An alternative would be this, but it’s longer:

```html
<img src="<?php echo kirby()->urls()->assets() . '/images/image.png'; ?>">

```

Today I learned from [this post](https://forum.getkirby.com/t/how-to-use-the-new-asset-class-to-generate-thumbnails/4245) that it’s also possible to create an object and use that instead. It’s longer but it’s possible to do things like resize and crop the asset image.

```html
<?php $image = new Asset('assets/images/image.png'); ?>
<img src="<?php echo $image->url(); ?>">

```

What version would you use? And why?

---

<div class="post-metadata">

**Author:** ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)\
**Post date:** [September 13, 2016, 8:36am UTC](https://forum.getkirby.com/t/how-do-you-use-asset-urls/5242/2 "2016-09-13T08:36:26Z")

</div>

There’s another option I usually use:

```auto
<?php echo url('assets/images/image.png') ?>

```

I’d use the new Asset class if I need an image object.

---

<div class="post-metadata">

**Author:** ![jenstornell](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/jenstornell/32/546_2.png) [@jenstornell](https://forum.getkirby.com/u/jenstornell)\
**Post date:** [September 13, 2016, 8:51am UTC](https://forum.getkirby.com/t/how-do-you-use-asset-urls/5242/3 "2016-09-13T08:51:12Z")

</div>

That’s looking much better yes. 🙂

---

<div class="post-metadata">

**Author:** ![distantnative](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/distantnative/32/11319_2.png) [@distantnative](https://forum.getkirby.com/u/distantnative)\
**Post date:** [February 6, 2025, 4:55pm UTC](https://forum.getkirby.com/t/how-do-you-use-asset-urls/5242/4 "2025-02-06T16:55:19Z")

</div>

Archived on February 6, 2025, 4:55pm UTC


