hoseinisalim

hoseinisalim

Create image thumbnail in windows environment

i am using ffmpeg library for thumbnail image. My project runs in windows environment.
When executing the following code:

Thumbnex.create_thumbnail(url, new_url ,max_width: 64,max_height: 64)

I receive the following error in my code:

System.cmd("ffprobe", ["-show_format", "c:/Users/Salim/Desktop/Data/Elixir/Upload/d2e04a59-5fef-4f22-82d5-e0c6a1f25ea6.jpeg"], [stderr_to_stdout: true])
** (ErlangError) Erlang error: :enoent

ImageMagic and FFprobe installed on my system.

Most Liked

hauleth

hauleth

Are these in your %PATH%? Because that is how System.cmd/2 is looking for executables. Just installing them doesn’t necessarily add it to %PATH%.

dimitarvp

dimitarvp

First try this:

System.cmd("ffprobe", ["--version"])

To make sure that it can indeed be invoked. If so then the :enoent error means that the file parameter you supplied in your OP does not exist.

NobbZ

NobbZ

No, :enoent is only returned when the cmd wasn’t found.

If the cmd was found, and it was unable to find the file specified in its argument list, it has to communicate this fact through its exitcode, stout and stderr. You have access to the first 2 via the returned tuple then:

System.cmd("cat", ["this-file-does-not-exist"])
#=> {"", 1}

Of course, this is specific to cat, ffprobe might have a different exit code or output in this case.

Last Post!

dimitarvp

dimitarvp

Good to know. Thank you. :+1:

Where Next?

Popular in Questions Top

electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
skosch
To my knowledge, put_in, Map.update etc. all have the one limitation of not automatically creating intermediate keys when needed (for exa...
New
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
Fl4m3Ph03n1x
About me? ( if you have nothing better to do than reading about some random guy in the internet :stuck_out_tongue: ) Hello all, this is ...
New
greenz1
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
New
fayddelight
I tried installing elixir 1.11.2 erlang 23.3.4 via asdf in my zsh shell. Enabled the versions locally and globally. When I list them ...
New

Other popular topics Top

JeremM34
Hello, how can I check the Phoenix version ? Thanks !
New
JakeBecker
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
1144 55125 245
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
dogweather
I wrote this comment on r/haskell, and it’s not popular there. :wink: But I think I’m on to something… Haskell reminds me of Java, and e...
New
greenz1
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
axelson
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!) This post collects co...
239 49266 226
New

We're in Beta

About us Mission Statement