Hi all, 
I am quite new to ChicagoBoss and I am struggling to just add a simple 
function to an existing model module. 
My module is image.erl. 

I have a function called create_processed_file():

create_processed_file(FileType, Size)  ->


lager:info("-=> Stepping into create_processed_file <=-"),
OriginalFilename = THIS:get_filename(FileType, Size), 
GammaValue = THIS:gamma(),
NewFilename = THIS:apply_gamma_factor(OriginalFilename, GammaValue),
NewFilename.


I added THIS:apply_gamma_factor/2. 

The function is defined at the end of the file: 

apply_gamma_factor(Filename, Gamma) ->
lager:info("-=> GAMMA PROCESSING : ~p", [Gamma]),
ProcessedFilenamePart = "_gamma_" ++ io_lib:format("~4.2f", [Gamma]),
NewFilename = "/tmp/" ++ filename:rootname(filename:basename(Filename)) ++ 
ProcessedFilenamePart ++ filename:extension(Filename),
case (Gamma == 1.0) of
    true ->
        % if gamma == 1.0 let's just copy the original image with the new file 
name.
        lager:info("[apply_gamma_factor] - gamma = 1 - copying ~s to ~s . ", 
[Filename, NewFilename]),
        {ok, _} = file:copy(Filename, NewFilename);
    false ->
        % if gamma /= 1.0 then we need to create the processed image.
        case filelib:is_regular(NewFilename) of
            false -> %% send to graphicsmagick for processing
                GammaCmd = io_lib:format("gm convert -gamma ~f ~s ~s ",
                    [Gamma,
                        Filename,
                        NewFilename]),
                os:cmd(GammaCmd);
            true ->
                undefined
        end
end,
NewFilename.



I cleaned, built and restarted my CB application and every time I get the 
same error: 



*13:08:34.929 [info] -=> Stepping into create_processed_file 
<=-13:08:34.946 [error] gen_server gsd_report_server terminated with 
reason: no function clause matching 
image:apply_gamma_factor("./data/exams/5/c/6/5/a3a9-7762-450e-9dca-f738934cd773/image-5c65a3a9-7762-450e-9dca-f738934cd77...",
 
2.0, 
{image,"image-5c65a3a9-7762-450e-9dca-f738934cd773",<<"visible">>,undefined,{{2015,3,26},{14,5,52.0}},...})
 
line 19613:08:34.947 [error] CRASH REPORT Process gsd_report_server with 0 
neighbours exited with reason: no function clause matching 
image:apply_gamma_factor("./data/exams/5/c/6/5/a3a9-7762-450e-9dca-f738934cd773/image-5c65a3a9-7762-450e-9dca-f738934cd77...",
 
2.0, 
{image,"image-5c65a3a9-7762-450e-9dca-f738934cd773",<<"visible">>,undefined,{{2015,3,26},{14,5,52.0}},...})
 
line 196 in gen_server:terminate/7 line 804*
So it enters the create_processed_file function but somehow cannot 'see' 
the apply_gamma_factor/2 fuc, instead it looks for a function with more 
parameters. 
Could you please help me in solving this problem?
Thanks in advance

-- 
You received this message because you are subscribed to the Google Groups 
"ChicagoBoss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
Visit this group at http://groups.google.com/group/chicagoboss.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/chicagoboss/6d8cb159-f10d-4c1e-a379-147a40e8b210%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to