php - Get full file paths in ProcessWire ServicesPages API -


i'm building app using processwire. i'm using servicepages module expose data rest-like api.

however, files seem outputted this:

reel_poster: {     basename: "breakdown-2015-poster.jpg",     description: "",     tags: "",     formatted: false,     modified: 1468541707,     created: 1468541707 } 

how actual path / url of file referenced? need path in js app, can't use php api.

i've posted this on forums, seems there's not lot of activity there.

so, if read this forum post correctly, way create url assembling manually. need 3 things that:

  • the base path file assets.
  • the id of page field attached.
  • the image name.

we know base path file assets /site/assets/files/. can this, given have page object api:

var basepath = '/site/assets/files/'; var imagepath = basepath + page.id + '/' + page.image_field.basename; 

this should work. think. yes. tested , works.


Comments

Popular posts from this blog

javascript - Slick Slider width recalculation -

jsf - PrimeFaces Datatable - What is f:facet actually doing? -

angular2 services - Angular 2 RC 4 Http post not firing -