returning the file.urlName in the response

Started by Tijs_Teulings7 replies18 views
Tijs_TeulingsOriginal post
#1

Archived from the Transloadit support forum. Originally posted on February 4, 2011; details may be outdated, see our docs for current behavior. Original thread

I was wondering if it would be possible to return the file.urlName in the transloadit response. I use that variable in the path (+some prefixes for different versions of the image) so it would be nice if i could store just the filename instead of the full url in my database. That way when the image host or bucket name changes i won’t have to change each image entry in my database.

I could simply strip the other data from the URL so i’m left with just the filename of course so this issue is not a must-have but it would be nice to have…

Best,
Tijs

Felix_Geisendorfer
#2

Well, the file.urlName is really just the file.name with html entities escaped (htmlentities() in php). But I can see why that seems fragile / why you wouldn’t want to parse the url.

So we’ll consider adding support for this, and update the ticket if we do.

Tijs_Teulings
#3

Yeah, someday in the future somebody at transloadit will decide to create the urlName differently and a thousand kittens will die a senseless death / my app would break.

I have a solution in place for it for now, but yeah keep us posted.

Felix_Geisendorfer
#4

Well, if I was to develop an app I would safe the entire url in the database. If my urls ever change (due to a domain change for example), I would update all urls in my database to reflect that change. It seems like a less fragile approach to me, especially since it will also work well if you store your files under different paths.

What do you think?

Tijs_Teulings
#5

it depends?

i store the images based on an account id + portfolio id + unique filename on S3. Then when i need to retrieve them from S3 directly i can with the same key as when i need to retrieve that file from cloudfront or from a local cache just by changing the host part of the url. All three situation are possible depending on where and how i’m displaying the image. Works well for me… but i might change it after moving to transloadit since i’ll have all the sizes i need (just about) pre resized and available from S3. Will just need to replace the host with cloudfront in that case.

Felix_Geisendorfer
#6

Sorry for the late reply. Reading your last comment I’m not sure if you’re saying you still need this feature, or you don’t?

Tijs_Teulings
#7

No problem. No i don’t need the feature anymore but i still think it would be handy to have in there at some point since it would allow a bit more flexibility in how you handle things.

Felix_Geisendorfer
#8

Ok, I’ll keep it on my list!