starter icon indicating copy to clipboard operation
starter copied to clipboard

How to get pictures into ItemsAPI?

Open floppyapple123 opened this issue 8 years ago • 43 comments

I want to get the pdf icon on all of my entries, but I don't really know how to do so. Could anyone explain how to? I'm running it off of Heroku. Thanks.

floppyapple123 avatar Jul 10 '17 14:07 floppyapple123

You need to provide image field in all your entries then it will be displayed automatically. Otherwise if you have different field in the object then you can customize it in the layout /views/catalog.html.twig

cigolpl avatar Jul 10 '17 14:07 cigolpl

Is it possible to upload a local file?

floppyapple123 avatar Jul 10 '17 15:07 floppyapple123

Also, when I click on an item, is it possible to link it to a pdf file?

floppyapple123 avatar Jul 10 '17 15:07 floppyapple123

If you open /admin/images and configure AWS S3 then it should be possible to store images. Not sure how stable this feature was. It will be easier I guess if you provide link in your JSON file to external pdf / image

cigolpl avatar Jul 10 '17 15:07 cigolpl

If you customize ./views/catalog.html.twig and ./src/routes.js then everything should be possible. This starter is based on http://expressjs.com/

cigolpl avatar Jul 10 '17 15:07 cigolpl

Thanks. But can I link it to a opening pdf instead of going to this page? Thanks so much. image

floppyapple123 avatar Jul 10 '17 15:07 floppyapple123

Just open ./views/catalog.html.twig and find a part:

<div class="items">
  {% for item in items %}
  <div class="col-xs-3 col-md-3" style="height: 220px;">
    <a href="{% if item.permalink %}/item/{{ item.permalink }}{% else %}/id/{{ item.id }}{% endif %}" class="">
      <img class="img-thumbnail" src="{% if item.image %}{{ item.image }}{% else %}{{ image }} {% endif %}" alt="{{ item.domain }}">
      <p>{{ item.domain }}</p>
    </a>
  </div>
  {% endfor %}
</div>

and then provide a link there to your pdf instead of going to /item/:id

cigolpl avatar Jul 10 '17 15:07 cigolpl

How would I get here on Heroku?

floppyapple123 avatar Jul 10 '17 15:07 floppyapple123

You should run it on your localhost, modify and then redeploy. Not sure how to do it fast but I think this tutorial can be helpful https://devcenter.heroku.com/articles/getting-started-with-nodejs#introduction

cigolpl avatar Jul 10 '17 15:07 cigolpl

you already answered my question on linkedin (sorry for asking twice), but thank you so much

floppyapple123 avatar Jul 10 '17 20:07 floppyapple123

image now I'm getting an error with the npm install :/ Elasticsearch and MongoDB are up and running

floppyapple123 avatar Jul 10 '17 20:07 floppyapple123

Oh, you are using windows. I've never tried that with windows. It might get more complicated. Ideally if you use linux. Vagrant can help you run a virtual machine i.e. ubuntu on your windows (https://www.vagrantup.com/intro/getting-started/).

You can also try docker composer which starts everything for you out of the box on all operating systems. (https://www.itemsapi.com/docs/starter/installation/). There are some updates thanks to @fbertetto which allows you to edit files locally on your windows and run that easily using docker compose. Not sure how convenient is a development with docker composer though.

cigolpl avatar Jul 10 '17 20:07 cigolpl

Do you have mongodb installed on your localhost ? You can check it out by writing mongo in your CLI.

cigolpl avatar Jul 11 '17 15:07 cigolpl

Yeah I got that fixed.

On Tue, Jul 11, 2017 at 10:10 AM, Matt Rzepa [email protected] wrote:

Do you have mongodb installed on your localhost ? You can check it out by writing mongo in your CLI.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/itemsapi/starter/issues/20#issuecomment-314475754, or mute the thread https://github.com/notifications/unsubscribe-auth/AcFAP2O3vDr_45OjtWKjtG5t_W_PVztOks5sM5BZgaJpZM4OS8O0 .

floppyapple123 avatar Jul 11 '17 15:07 floppyapple123

I got everything to work :), but how do you make a range value with ItemsAPI. Like how would I be able to input data saying that an item has been in use from 2340 to 23948 hours?

floppyapple123 avatar Jul 12 '17 18:07 floppyapple123

Hello @floppyapple123, do you mean range aggregations like:

selection_280

or

selection_281

?

cigolpl avatar Jul 13 '17 08:07 cigolpl

Yeah. Also, for some reason I'm stuck on this page image when I hit submit, it just takes refreshes the page and does not go on. I created the heroku app by cloning directly from the github page.

floppyapple123 avatar Jul 13 '17 14:07 floppyapple123

Regarding 1) There are some info about aggregations - https://www.itemsapi.com/docs/starter/aggregations/. Usually such a aggregations are created automatically by "understanding" data in the installation process and later you can customize them in the administration panel.

Regarding 2) (Getting stuck on installation page) Heroku logs should provide you more information. You can find them using heroku cli or in dashboard. It can be a heroku problem (i.e. exceeded limit) or some elasticsearch error (some data error).

cigolpl avatar Jul 13 '17 14:07 cigolpl

image yeah it seems like an elasticsearch error

floppyapple123 avatar Jul 13 '17 15:07 floppyapple123

Are you trying with a demo items https://raw.githubusercontent.com/itemsapi/itemsapi-example-data/master/items/movies-processed.json or a custom one ?

cigolpl avatar Jul 13 '17 15:07 cigolpl

it works for neither the demo items nor a custom one. The log i attached above is from the demo items

floppyapple123 avatar Jul 13 '17 15:07 floppyapple123

@floppyapple123 it can be a index limit from a Heroku external ES provider. I had such a problem in the past. I was testing now and it's working fine. You can try to remove some of your heroku apps and try again.

cigolpl avatar Jul 13 '17 15:07 cigolpl

Heroku is using https://bonsai.io/ for ES. Maybe there are also some error information in bonsai directly

cigolpl avatar Jul 13 '17 15:07 cigolpl

So is there any way to see that?

On Thu, Jul 13, 2017 at 10:36 AM, Matt Rzepa [email protected] wrote:

Heroku is using https://bonsai.io/ for ES. Maybe there are also some error information in bonsai directly

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/itemsapi/starter/issues/20#issuecomment-315115610, or mute the thread https://github.com/notifications/unsubscribe-auth/AcFAP_4J2bC4yLppKUZLFc5cxf8q1f-jks5sNjl7gaJpZM4OS8O0 .

floppyapple123 avatar Jul 13 '17 15:07 floppyapple123

image

floppyapple123 avatar Jul 13 '17 15:07 floppyapple123

Not sure how to fix it. Maybe there is a limit in index amount and removing some of them will be a solution

cigolpl avatar Jul 13 '17 15:07 cigolpl

I've already deleted all but two apps in my heroku

floppyapple123 avatar Jul 13 '17 15:07 floppyapple123

I've gotten it to run the same way before, i don't know why its messing up right now

floppyapple123 avatar Jul 13 '17 15:07 floppyapple123

Could you try again from scratch https://heroku.com/deploy?template=https://github.com/itemsapi/starter/tree/master ?

cigolpl avatar Jul 13 '17 16:07 cigolpl

Deploying from there works fine. The problem I'm having is that I need to edit the catalog.html.twig file, so I'm getting it locally, by going into CMD and hitting

$heroku login (enter in my info) $git clone https://github.com/itemsapi/starter.git $cd starter $heroku create $git push heroku master $heroku open

floppyapple123 avatar Jul 13 '17 16:07 floppyapple123