# Will GetUrlToImage create a new file before url is hit?

**URL:** <https://forum.litium.com/t/will-geturltoimage-create-a-new-file-before-url-is-hit/1333>\
**Category:** Questions\
**Created:** [February 16, 2020, 8:28pm UTC](https://forum.litium.com/t/will-geturltoimage-create-a-new-file-before-url-is-hit/1333 "2020-02-16T20:28:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Robin.w](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/robin.w/32/75_2.png) [@Robin.w](https://forum.litium.com/u/Robin.w)\
**Post date:** [February 16, 2020, 8:28pm UTC](https://forum.litium.com/t/will-geturltoimage-create-a-new-file-before-url-is-hit/1333/1 "2020-02-16T20:28:02Z")

</div>

Hi am exposing some media files as a javascript object. I want to have a few different size options so I run GetUrlToImage(size,size) multiple times when creating the js object, but will probably only use one size to start with until the possible frontend design change.

Will GetUrlToImage actually create the file on disk when the url is generated or can I prepare the url’s without creating lots of unnecessary files on disk, if the url’s is not in use?

If it creates the files, is my only option to create an endpoint with allowed sizes that do the resize dynamically?

Litium version: 7.3

---

<div class="post-metadata">

**Author:** ![patric.forsgard](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.litium.com/patric.forsgard/32/10_2.png) [@patric.forsgard](https://forum.litium.com/u/patric.forsgard)\
**Post date:** [February 17, 2020, 7:13am UTC](https://forum.litium.com/t/will-geturltoimage-create-a-new-file-before-url-is-hit/1333/2 "2020-02-17T07:13:11Z")

</div>

The URL is generated without generating the physical file. The physical file is generated up on first request.

The url that is generated is also containing an hash of the parts of the url that are validated, the reason of this is that you don’t want a _bad_ visitor to make requests to the same image with different sizes to fill up the disc that may let the site to go down.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex030/uploads/litium/original/1X/12eddac3b8b661de1db86af10ac8151b571e6fb9.png) [@system](https://forum.litium.com/u/system)\
**Post date:** [March 16, 2020, 7:13am UTC](https://forum.litium.com/t/will-geturltoimage-create-a-new-file-before-url-is-hit/1333/3 "2020-03-16T07:13:25Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
