• Home
  • Categories
  • Recent
  • Popular
  • Top
  • Tags
  • Users
  • Groups
  • Documentation
    • Home
    • Read API
    • Write API
    • Plugin Development
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
v3.5.2 Latest
Buy Hosting

uploads/picture.png stored in redis when uploaded, need uploads/picture.png instead

Scheduled Pinned Locked Moved NodeBB Development
25 Posts 5 Posters 6.2k Views
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • danBBD Offline
    danBBD Offline
    danBB
    wrote on last edited by psychobunny
    #1

    Hello,
    When I upload a catagory picture as an admin, it stores the path on redis to the image like such "http://127.0.0.1:4567/uploads/picture.png"

    I need the stored path to only be "/uploads/picture.png" to work properly. Where is that code located that uploads the image path to redis? Thanks

    1 Reply Last reply
    0
  • B Offline
    B Offline
    bentael Plugin & Theme Dev
    wrote on last edited by
    #2

    this is not uploading to redis, this is actually on the file system.

    cd [NODEBB_INSTALLATION_PATH]/public/uploads
    ls 
    # you will see the files there
    

    I need the stored path to only be "/uploads/picture.png" to work properly. Where is that code located that uploads the image path to redis? Thanks

    I am not sure what you mean by that, you want to get rid of the port number? :4567?

    1 Reply Last reply
    0
  • danBBD Offline
    danBBD Offline
    danBB
    wrote on last edited by
    #3

    @bentael yes, I know the image is stored in the file system. What I'm talking about is the file path that is stored in redis.

    For example, if the the admin uploads a new catagory image, it will upload the actual file to the file system and a path to that file in to redis. The path string stored in redis includes the loaclhost ip. I just need "/uploads/picture.png" stored as the path so my pages can load the image correctly

    1 Reply Last reply
    0
  • B Offline
    B Offline
    bentael Plugin & Theme Dev
    wrote on last edited by
    #4

    ahh, sorry I misread what your post. sorry. let me take a look

    1 Reply Last reply
    0
  • B Offline
    B Offline
    bentael Plugin & Theme Dev
    wrote on last edited by bentael
    #5

    it's here.. https://github.com/designcreateplay/NodeBB/blob/master/src/routes/admin.js#L102
    is this only happening for categories or profile pics as well?

    weird, that block never touches the db

    1 Reply Last reply
    0
  • danBBD Offline
    danBBD Offline
    danBB
    wrote on last edited by danBB
    #6

    @bentael yeah happens for both places.

    Also happens when I upload the website logo.

    Any ideas?

    1 Reply Last reply
    0
  • B Offline
    B Offline
    bentael Plugin & Theme Dev
    wrote on last edited by bentael
    #7

    same thing. for example, take a look at the user profile pic logic here: https://github.com/designcreateplay/NodeBB/blob/master/src/routes/user.js#L180

    the resolved path is saved in the db, not the relative path, To fix that, there would more logic involved to check if the image starts with http://or https:// then load it as it is, if not, then prepend the rootUrl+relativeUrl+uploadPath+imagename .. i think. .unless they want to keep track on an uploadedimage just like the code does for the User, I am not too sure they want to deal with it or not.

    Even wordpress does that, I hated it when i moved from dev.site to site, or vice versa.

    I would submit an issue see what the NBB team have to say.

    1 Reply Last reply
    0
  • danBBD Offline
    danBBD Offline
    danBB
    wrote on last edited by
    #8

    @bentael k, Whats the easiest way to get into my redis database and manually change the data?

    1 Reply Last reply
    0
  • trevorT Offline
    trevorT Offline
    trevor Plugin & Theme Dev Anime Lovers GNU/Linux
    wrote on last edited by trevor
    #9

    @danBB, that's a bit of a messy situation but you can use the redis-cli for experts, or you can use a GUI like Redis Commander, npm install redis-commander -g or something like a webGUI such as http://redsmin.com/

    1 Reply Last reply
    0
  • B Offline
    B Offline
    bentael Plugin & Theme Dev
    wrote on last edited by bentael
    #10

    @danBB

    if you are familiar with the redis-cli syntax, just

    # on the command line, just type 
    redis-cli
    # if not in your PATH, then just cd to, i.e on my mac it's in Downloads so I just
    cd ~/Downloads/redis-2.6.16
    ./src/redis-cli
    

    if you're not, I would install redis-commander it's awesome, once you install it, just run:

    # in your terminal
    redis-commander
    

    then visit http://localhost:8081/ to view your db

    EDIT yup, @trevor beat me to it as i was typing, but anyways, either ways are not a good solution if you want to edit a large number of records

    1 Reply Last reply
    0
  • trevorT Offline
    trevorT Offline
    trevor Plugin & Theme Dev Anime Lovers GNU/Linux
    wrote on last edited by trevor
    #11

    @bentael We basically posted at the same time and the same thing almost lol.

    Also, for editing large number of records, I use redsmin.

    1 Reply Last reply
    1
  • B Offline
    B Offline
    bentael Plugin & Theme Dev
    wrote on last edited by
    #12

    @trevor haha yea, I saw your post popup as i was typing, i was so wired that I still posted it anyways.

    redsmin .. hmm .. thanks, I will take a look

    1 Reply Last reply
    0
  • B Offline
    B Offline
    bentael Plugin & Theme Dev
    wrote on last edited by
    #13

    @trevor

    Also, for editing large number of records, I use redsmin.

    redsmin looks awesome! the graphs and stats, but still not sure how to edit large number of records without writing some logic, just like i would do in the redis-cli or a simple node program, am I missing something?

    1 Reply Last reply
    0
  • danBBD Offline
    danBBD Offline
    danBB
    wrote on last edited by
    #14

    Thanks guys, manually editing the path in redis fix the image display problem. Temporary fix for now

    1 Reply Last reply
    0
  • barisB Offline
    barisB Offline
    <baris> NodeBB
    wrote on last edited by
    #15

    I am working on the fix hold tight!

    1 Reply Last reply
    1
  • danBBD Offline
    danBBD Offline
    danBB
    wrote on last edited by
    #16

    @baris Also when I upload a gif it stores it as a png

    1 Reply Last reply
    0
  • barisB Offline
    barisB Offline
    <baris> NodeBB
    wrote on last edited by baris
    #17

    @danBB There is a setting in admin section to turn images into pngs is that turned on?

    1 Reply Last reply
    0
  • danBBD Offline
    danBBD Offline
    danBB
    wrote on last edited by
    #18

    @baris no its unchecked, and its only with gifs.

    I also wasnt clear I ment that it uploads it to the directory as a gif but labels it as a png in the path string in redis

    1 Reply Last reply
    0
  • barisB Offline
    barisB Offline
    <baris> NodeBB
    wrote on last edited by
    #19

    Is this just for user profile images?

    1 Reply Last reply
    0
  • psychobunnyP Offline
    psychobunnyP Offline
    psychobunny
    wrote on last edited by psychobunny
    #20

    wooops, this is starting to sound like my fault.

    edit: if the checkbox is off, this should leave your gifs as is (see my profile pic) - otherwise I guess its a bug

    1 Reply Last reply
    0

Copyright © 2023 NodeBB | Contributors
  • Login

  • Don't have an account? Register

  • Login or register to search.
Powered by NodeBB Contributors
  • First post
    Last post
0
  • Home
  • Categories
  • Recent
  • Popular
  • Top
  • Tags
  • Users
  • Groups
  • Documentation
    • Home
    • Read API
    • Write API
    • Plugin Development