Jump to content

Tiny PNG workflow [Updated to v1.2]


Recommended Posts

  • 1 month later...
  • 2 weeks later...
  • 4 weeks later...
  • 1 month later...
  • 5 months later...

Hi,

 

I'm a newbie with workflows and don't know where to put the API code.

I go to: tinypng_config within the workflow and see /bin/bash

 

key="{query}"
 
#Storage directory for API key
PREFS="$HOME/Library/Application Support/Alfred 2/Workflow Data/carlosnz.tinypng"
 
#Create storage folder
mkdir -p "$PREFS"
 
#Save user's key to storage file
echo "$key">"$PREFS/api_key"
 
#Notify
echo "New API key applied:"$'\n'"$key"
 
 
Where can I put the API?
 
Best regards,
Hendrik

 

Link to comment

You don't need to go to tinypng_config in the workflow... just start typing tiny into Alfred and you will be provided with three options. One option will be "Enter/Change API Key". Choose this option and it will prompt for your API key. Paste your key, hit return and you should be good to go.

 

Hi,

 

I'm a newbie with workflows and don't know where to put the API code.

I go to: tinypng_config within the workflow and see /bin/bash

 

key="{query}"
 
#Storage directory for API key
PREFS="$HOME/Library/Application Support/Alfred 2/Workflow Data/carlosnz.tinypng"
 
#Create storage folder
mkdir -p "$PREFS"
 
#Save user's key to storage file
echo "$key">"$PREFS/api_key"
 
#Notify
echo "New API key applied:"$'\n'"$key"
 
 
Where can I put the API?
 
Best regards,
Hendrik

 

Link to comment
  • 1 year later...
1 hour ago, funkymonkey said:

Anyone on High Sierra (GM) using this workflow?

Mine has stopped working.

I use it every day as well :(

 

The report just states:

FILE: /Users/me/Documents/Temp/test4.png
Problem downloading test4_shrink.png

 I'll check it out once I install HS later this week. Thanks.

Link to comment
1 hour ago, CarlosNZ said:

 I'll check it out once I install HS later this week. Thanks.

 

Hey, this is not related to the HS issue but once you look into it remember to change the location of the data folder by adopting the environment variable instead of hard coding the path, since Alfred 2 and 3 have different locations for persistent data. So you can use this:

 

#Storage directory for API key
PREFS="$alfred_workflow_data"

Link to comment
On 9/25/2017 at 7:15 AM, funkymonkey said:

Anyone on High Sierra (GM) using this workflow?

Mine has stopped working.

I use it every day as well :(

 

The report just states:

FILE: /Users/me/Documents/Temp/test4.png
Problem downloading test4_shrink.png

 

It's working for me on the first public release.

Link to comment

I completely uninstalled it then reinstalled and set it up from scratch.

 

Working now! :)

 

I wondered if the location I had set had something to do with it. i.e. I had changed the default location from desktop to another folder. Then updated macOS (obviously including new file system) then it broke. Anyway it works now (with the previous location change).

Link to comment
3 hours ago, flatcoke said:

if It doesn't work with alfred3 

try to fix tinypng_config script 

 

PREFS="$HOME/Library/Application Support/Alfred 3/Workflow Data/carlosnz.tinypng"

 

It may be Alfred 2 folder in your setting

 

Changing the data folder path will not fix any issue with the workflow. Additionally, hard-coding the data folder path is not a good practice as you can use the environment variable like I told four posts above yours:

 

 

Edited by xilopaint
Link to comment
  • 2 years later...

Hello and thank you for the great workflow.

I am trying to configure it.
Is this workflow supporting Alfred 4?

For me, the workflow works sometimes, sometimes not - http://joxi.net/eAO6y1pF974Z92

I get this error - "Problem downloading feature-location-3.jpg"

I replaced this path:
PREFS="$HOME/Library/Application Support/Alfred 4/Workflow Data/carlosnz.tinypng" from Alfred 2 to Alfred 4 - but it didn't help. (Before (when the path was $HOME/Library/Application Support/Alfred 2/...) it worked the same way 50/50 - sometimes correct, sometimes error)
I am using Mojave 10.14.6

I am using my own API key for ЕнтнЗТПю

I will be glad to any help. Maybe I am doing something wrong.

Link to comment
13 hours ago, Roman52 said:

Hello and thank you for the great workflow.

I am trying to configure it.
Is this workflow supporting Alfred 4?

For me, the workflow works sometimes, sometimes not - http://joxi.net/eAO6y1pF974Z92

I get this error - "Problem downloading feature-location-3.jpg"

I replaced this path:
PREFS="$HOME/Library/Application Support/Alfred 4/Workflow Data/carlosnz.tinypng" from Alfred 2 to Alfred 4 - but it didn't help. (Before (when the path was $HOME/Library/Application Support/Alfred 2/...) it worked the same way 50/50 - sometimes correct, sometimes error)
I am using Mojave 10.14.6

I am using my own API key for ЕнтнЗТПю

I will be glad to any help. Maybe I am doing something wrong.

 

Try this:

 

On 9/25/2017 at 10:34 AM, xilopaint said:

 

Hey, this is not related to the HS issue but once you look into it remember to change the location of the data folder by adopting the environment variable instead of hard coding the path, since Alfred 2 and 3 have different locations for persistent data. So you can use this:

 


#Storage directory for API key
PREFS="$alfred_workflow_data"

 

Link to comment
  • 2 weeks later...
On 12/9/2019 at 12:37 AM, xilopaint said:

 

Try this:

 

 

On 12/9/2019 at 12:02 PM, deanishe said:

 

Alfred 4 doesn't use the "Alfred 4" directory. It's just called "Alfred" now. But in any case, do what @xilopaint says.

Hello @xilopaint , @deanishe and thank you for your answers.

I made this change - http://snpy.in/8NlGMK - but it didn't help - I still have this "problem downloading" issue. http://snpy.in/VUI4Tr

I imported the tinyPNG workflow and made only one change in tinypng.sh file as you told me. 

Edited by Roman52
Link to comment
On 12/22/2019 at 5:16 AM, Roman52 said:

 

Hello @xilopaint , @deanishe and thank you for your answers.

I made this change - http://snpy.in/8NlGMK - but it didn't help - I still have this "problem downloading" issue. http://snpy.in/VUI4Tr

I imported the tinyPNG workflow and made only one change in tinypng.sh file as you told me. 

 

You have to make the same change in the Run Script object connected to the tiny_png_config keyword on Alfred Editor.

 

740556971_ScreenShot2019-12-23at10_33_24.png.2ea5818b2b0a89fd1680dff811cd4102.png

Link to comment
On 12/25/2019 at 9:44 AM, xilopaint said:

@Roman52 please, try running the workflow again and paste here the output of the Alfred debbuger.

 

Hello, @xilopaint , thank you for trying to help.


Here is the debug output:

[11:21:44.918] Logging Started...
[11:22:00.529] Tiny PNG[Keyword] Processing complete
[11:22:00.532] Tiny PNG[Keyword] Passing output '' to Run Script
[11:23:23.076] STDERR: Tiny PNG[Run Script] 35:44: syntax error: A “"” can’t go after this identifier. (-2740)
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100  176k  100  176k    0     0   403k      0 --:--:-- --:--:-- --:--:--  402k
35:44: syntax error: A “"” can’t go after this identifier. (-2740)
curl: (3) <url> malformed
35:44: syntax error: A “"” can’t go after this identifier. (-2740)
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
100  186k  100  186k    0     0   380k      0 --:--:-- --:--:-- --:--:--  380k
100  186k  100  186k    0     0   380k      0 --:--:-- --:--:-- --:--:--  380k
[11:23:23.083] Tiny PNG[Run Script] Processing complete
[11:23:23.083] Tiny PNG[Run Script] Passing output '2 files downloaded to /Desktop/TinyPNG. 
1 file had problems.
See ~Report~.txt for details.' to Post Notification

Here is the report file:

FILE: /Users/roman52/Disk/PSD/projects/Grove at Auburn/04 Gallery/Apartment/g-1.jpg
Original size: 388140
Shrunk size: 180857
Ratio: 0.466

FILE: /Users/roman52/Disk/PSD/projects/Grove at Auburn/04 Gallery/Apartment/g-2.jpg
Problem downloading g-2_shrink.jpg

FILE: /Users/roman52/Disk/PSD/projects/Grove at Auburn/04 Gallery/Apartment/g-3.jpg
Original size: 394228
Shrunk size: 190620
Ratio: 0.4835

 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...