strapi-plugin-images
strapi-plugin-images copied to clipboard
TypeError: cb is not a function
Can't get the server to start at all after adding this plugin. Get the above cb error in plugins/images/middlewares/images/index.js:41:5
Node: v10.15.3 npm: 6.11.3 Strapi: v3.0.0-beta.17.4
Any help much appreciated. Easily ability to crop and resize images will be the decider on whether I use Strapi or not... 😨
Oh and also in bootstrap.js
I added a if (cb) {}
around both instances and now it doesn't break Strapi, but at the same time I can't really work out what I'm meant to do to get it working, as adding ?resize=400x300 doesn't do anything it seems...?
Me again! I realised that it's actually a different path than normal images, so I tried that instead (ie, changing uploads/
to images/
) but now it's coming up with something else...?
My URL is like http://localhost:1337/images/6c392e9762c545579b12850f2953f13d?size=400x300
Any ideas? Thanks!
Error: Undefined binding(s) detected when compiling SELECT. Undefined column(s): [upload_file.id] query: select `upload_file`.* from `upload_file` where `upload_file`.`id` = ? limit ?
at QueryCompiler_SQLite3.toSQL (/foo/node_modules/strapi-hook-knex/node_modules/knex/lib/query/compiler.js:101:13)
gUeSs wHo!?
So as it says in the guide, if you hit the normal JSON endpoint it will return a resize_url. This isn't happening.
I commented out the line if (ctx.get('Content-Type') != 'application/json' || !ctx.body) return;
and now it adds that value, but only if it's a one-deep nested image. Otherwise it doesn't work. Still causes above issues too. But returns "resize_url": "/images/undefined"
Is this plugin just not compatible with latest changes to strapi?
More hacking.
Replaced all instances of _id
with id
. This seems to fix a fair amount of stuff.
I also now realise that the ID put into the URL should be a single integer rather than the hash of the file, which is kinda odd in itself but ho hum.
The route responds with JSON and a buffer. Why is this? Is there a reason it doesn't just return a proper image with a JEPG mimetype?
@MaffooBristol it seems this guy is working to solve it: https://github.com/Froelund/strapi-plugin-images/pull/8
Thank you @MaffooBristol, i fixed all bugs with your issue and it works for me.