Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lqip cannot process image name with a number at the end #47

Closed
sira313 opened this issue Mar 23, 2019 · 7 comments
Closed

Lqip cannot process image name with a number at the end #47

sira313 opened this issue Mar 23, 2019 · 7 comments

Comments

@sira313
Copy link

sira313 commented Mar 23, 2019

my file name is /img/asset/Aronath2.jpg
here's the --debug result

03:37:01.192 ERROR Can not find file: /img/asset/Aronath2jpg
Error: Can not find file: /img/asset/Aronath2jpg
    at /home/sira/Templates/Aflasio.com/www.aflasio.com/node_modules/hexo-filter-lqip/lqip/process.js:29:29                                                                                          
    at assignReplacement (/home/sira/Templates/Aflasio.com/www.aflasio.com/node_modules/string-replace-async/index.js:34:18)                                                                         
    at /home/sira/Templates/Aflasio.com/www.aflasio.com/node_modules/string-replace-async/index.js:53:10                                                                                             
    at Array.map (<anonymous>)                                                                                                                                                                       
    at concurrency (/home/sira/Templates/Aflasio.com/www.aflasio.com/node_modules/string-replace-async/index.js:52:25)                                                                               
    at processString (/home/sira/Templates/Aflasio.com/www.aflasio.com/node_modules/string-replace-async/index.js:71:9)                                                                              
    at fn (/home/sira/Templates/Aflasio.com/www.aflasio.com/node_modules/string-replace-async/index.js:81:26)                                                                                        
    at stringReplaceAsync (/home/sira/Templates/Aflasio.com/www.aflasio.com/node_modules/string-replace-async/index.js:88:9)                                                                         
    at processType (/home/sira/Templates/Aflasio.com/www.aflasio.com/node_modules/hexo-filter-lqip/lqip/process.js:23:10)                                                                            
    at /home/sira/Templates/Aflasio.com/www.aflasio.com/node_modules/hexo-filter-lqip/lqip/process.js:59:12                                                                                          
    at tryCatcher (/home/sira/Templates/Aflasio.com/www.aflasio.com/node_modules/bluebird/js/release/util.js:16:23)                                                                                  
    at Object.gotValue (/home/sira/Templates/Aflasio.com/www.aflasio.com/node_modules/bluebird/js/release/reduce.js:157:18)                                                                          
    at Object.gotAccum (/home/sira/Templates/Aflasio.com/www.aflasio.com/node_modules/bluebird/js/release/reduce.js:144:25)                                                                          
    at Object.tryCatcher (/home/sira/Templates/Aflasio.com/www.aflasio.com/node_modules/bluebird/js/release/util.js:16:23)                                                                           
    at Promise._settlePromiseFromHandler (/home/sira/Templates/Aflasio.com/www.aflasio.com/node_modules/bluebird/js/release/promise.js:512:31)                                                       
    at Promise._settlePromise (/home/sira/Templates/Aflasio.com/www.aflasio.com/node_modules/bluebird/js/release/promise.js:569:18)                                                                  
    at Promise._settlePromiseCtx (/home/sira/Templates/Aflasio.com/www.aflasio.com/node_modules/bluebird/js/release/promise.js:606:10)                                                               
    at _drainQueueStep (/home/sira/Templates/Aflasio.com/www.aflasio.com/node_modules/bluebird/js/release/async.js:142:12)                                                                           
    at _drainQueue (/home/sira/Templates/Aflasio.com/www.aflasio.com/node_modules/bluebird/js/release/async.js:131:9)                                                                                
    at Async._drainQueues (/home/sira/Templates/Aflasio.com/www.aflasio.com/node_modules/bluebird/js/release/async.js:147:5)                                                                         
    at Immediate.Async.drainQueues (/home/sira/Templates/Aflasio.com/www.aflasio.com/node_modules/bluebird/js/release/async.js:17:14)                                                                
    at runCallback (timers.js:794:20)                                                                                                                                                                
    at tryOnImmediate (timers.js:752:5)                                                                                                                                                              
    at processImmediate [as _immediateCallback] (timers.js:729:5)

if possible, please add feature to make it simple just add class name to use lqip in the future
for example:

<img class="lqip" src="/myimage.jpg"/>

your plugins is awesome
thanks

@sira313 sira313 changed the title Lqip cannot proceed image name with a number at the end Lqip cannot process image name with a number at the end Mar 23, 2019
@ertrzyiks
Copy link
Collaborator

Hey @sira313, thanks for taking time and reporting this issue.

Since I'm not able to reproduce this issue by just adding a number to the file name, I would need more details on how do you use the plugin.

Do you have a public repo where I can reproduce this issue?
I would check what is passed as a path here:

exports.lqipFor = function lqipFor(path, opts) {
Is there any chance that you pass a file name without that dot to the lqipFor helper?

@sira313
Copy link
Author

sira313 commented Mar 30, 2019

The only issue i've found is just like i told before.
Here's my repo that i use hexo-filter-lqip
https://gitlab.com/sira313/www.aflasio.com/commit/8a630d457ce21cdf5d938e436da0b4e1a3c5a550

@ertrzyiks
Copy link
Collaborator

@sira313 thanks for sharing the link. I was able to reproduce the issue you described on my computer and noticed that the problem is occuring only if you have hexo-neat plugin enabled. That plugin transforms meta data created by lqip plugin.

I'm checking if we can do anything about it to prevent a clash between those plugins.

@ertrzyiks
Copy link
Collaborator

@sira313 I submitted a PR which should prevent such issues from happening. #50

I will fix specs and test it a bit before releasing a new version of this plugin. Meanwhile, you can check it out to see if it solves your issue, for example by installing it from the branch with

npm

npm install hexojs/hexo-filter-lqip#encode-path-in-content

or yarn

yarn add hexojs/hexo-filter-lqip#encode-path-in-content

@ertrzyiks
Copy link
Collaborator

I actually merged the fix and released 1.3.1 with a patch for this issue. Please let me know if it's solved for you.

@sira313
Copy link
Author

sira313 commented Apr 2, 2019

I actually merged the fix and released 1.3.1 with a patch for this issue. Please let me know if it's solved for you.

Thanks, it's solved. My only problem is just i don't know how write that in my custom theme griddy yet. No problem, it's just 'cause i am not a coder 😊

@ertrzyiks
Copy link
Collaborator

@sira313 let's open another issue for that #51. The problem is it's impossible to provide a solution that works for everyone and all the cases.

Meanwhile, you can see how is it done in the example https://github.com/ertrzyiks/hexo-lqip-example and copy-paste some code from there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants