It's a while since I got tangled in this stuff, but is it possible that it is related to the fact that models are passed to their methods as the first (hidden) parameter?
Try removing the "THIS:" and I think you may find that it works. NewFilename = apply_gamma_factor(OriginalFilename, GammaValue), If you really want the "THIS:" where you have it to explicitly provide the module for the call , try passing it also as the first parameter to the call. NewFilename = THIS:apply_gamma_factor(THIS, OriginalFilename, GammaValue), g On 13 July 2015 at 17:07, emacstheviking <[email protected]> wrote: > First glance.... apply_gamma_factor/2 .... at a brief look the failing > call seems to be supplying more than two arguments... check your code and > make sure you are calling it how it expects to be called perhaps!? > > Sean. > > > > On 9 July 2015 at 12:17, <[email protected]> wrote: > >> 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 >> <https://groups.google.com/d/msgid/chicagoboss/6d8cb159-f10d-4c1e-a379-147a40e8b210%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > > -- > 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/CAEiEuU%2BuCaY_oandHCnbiq8d4w%3DvLanGV-VCX%3DqXKPUuK6q%3Dvw%40mail.gmail.com > <https://groups.google.com/d/msgid/chicagoboss/CAEiEuU%2BuCaY_oandHCnbiq8d4w%3DvLanGV-VCX%3DqXKPUuK6q%3Dvw%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- 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/CAKF5fiCT8seZ66aHxSsri23Z3b_jMFqks7%3Dpc-kPc1aoDG0dEA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
