Code Monkey home page Code Monkey logo

Comments (14)

joernroeder avatar joernroeder commented on May 29, 2024 1

Yes, no need to rush here. Let’s wait. Thanks and enjoy the weekend!

from kirby-colorextractor.

sylvainjule avatar sylvainjule commented on May 29, 2024

Do you have a specific setup? Does it happens with the upload hook or the button ?

I still probably lack understanding of k3's images behavior at this point, I don't understand how images would be prefixed with media in an installation but not another.

from kirby-colorextractor.

joernroeder avatar joernroeder commented on May 29, 2024

@sylvainjule happens with the button in the panel. my folder structure is similar to the one in devkit https://github.com/k-next/devkit to keep everything except the entrypoint outside the domain root.
the media folder will be created in public by kirby.
there is also the https://nnnnext.getkirby.com/docs/cheatsheet/roots/media function which should return the path

from kirby-colorextractor.

sylvainjule avatar sylvainjule commented on May 29, 2024

Thanks, I probably won't be able to take a look tomorrow but I will asap!

from kirby-colorextractor.

joernroeder avatar joernroeder commented on May 29, 2024

no problem, thanks!

from kirby-colorextractor.

joernroeder avatar joernroeder commented on May 29, 2024

@sylvainjule did you find some time to look into this? i would love to use it for a site which launches on monday. it would be a nice addition, nothing road blocking. no prob if you don't find some time, i'll stick with my current plan then… thx!

from kirby-colorextractor.

sylvainjule avatar sylvainjule commented on May 29, 2024

I'm having a look now but I can't reproduce this with a fresh devkit... colors are extracted as they should and no errors thrown.

Perhaps you could zip me a truncated version of your setup, changing the content if confidential, etc. so that I can debug on the correct folder structure?

from kirby-colorextractor.

sylvainjule avatar sylvainjule commented on May 29, 2024

Also could you screenshot me the response / error thrown ?

from kirby-colorextractor.

joernroeder avatar joernroeder commented on May 29, 2024

@sylvainjule responses from http://localhost:8000/plugins/colorextractor/process-image are coming back with the following json:

{
    "status":"error",
    "error":"file_get_contents(\/media\/pages\/pageid\/myimage-300x200-q90.jpg): failed to open stream: No such file or directory"
}

for various reasons (reverse proxy, docker, ci) i had to set 'url' => '/' in my config and i think therefore file_get_contents() looks in server root. apart from not finding anything, this is also a potential security issue.

from kirby-colorextractor.

sylvainjule avatar sylvainjule commented on May 29, 2024

Ok thanks, with this config tweak I get the same error.

But since kirby has been told to rewrite its urls we can't rely on $kirby->url('media') either as it returns the same prefix. Looking for a workaround.

from kirby-colorextractor.

sylvainjule avatar sylvainjule commented on May 29, 2024

The last commit fixes it for me.

(be careful though, I still need to set a cache for the plugin, I'm relying a lot on $site->index() for now, if your website is content-heavy it might not like it)

from kirby-colorextractor.

joernroeder avatar joernroeder commented on May 29, 2024

just pretty quick:

But since kirby has been told to rewrite its urls we can't rely on $kirby->url('media') either as it returns the same prefix.

Url rewriting doesnt matter here imo as its about the absolute file system/disk path via $kirby->roots()
https://nnnnext.getkirby.com/docs/framework/cms/app/roots

from kirby-colorextractor.

sylvainjule avatar sylvainjule commented on May 29, 2024

My bad, within the new docs, what should have been $kirby->roots()->media() is shown as $kirby->url('media'), which returns the url of the folder, not its disk path.

Actually the better way would be to call $thumb->root() or $thumb->mediaRoot(), but I can't go with it right now as there is an issue with the $thumb object, this is why I went for url. Probably best to wait for its fix than getting lost in quickfixes that will need to be changed in the end.

from kirby-colorextractor.

sylvainjule avatar sylvainjule commented on May 29, 2024

Should be fixed, switched to root(). ✅
Don't hesitate to reopen if not.

from kirby-colorextractor.

Related Issues (13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.