Re: [PEPr] Images::Imagick proposal, Conjure conjunction

From: Date: Wed, 05 May 2004 18:03:43 +0000
Subject: Re: [PEPr] Images::Imagick proposal, Conjure conjunction
References: 1 2  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-28856@lists.php.net to get a copy of this message
> And now, for the details of linking with IM_Conjure, > what about the suggestion of Alan for the magick underlaying calls? > reminder (abbr): > $im = new IM; > $im->anyFilter(array( > 'paramFoo' => 3, > 'paramBar' => 12, > )); > I totaly agree with this suggestion. > (I've thought about doing this yet, but did not because there has other points > I thought that sould be done before, but it seems that's now or never) > > But the question will then be, if we all agree on this point, that > > If the weird pear::IM names are kept there should be an array for > corespondence with standard IM names to call this class: > $im->{$correspondence[$stdIM_name]}(array( > 'paramSome' => 3, > 'someParam' => 12, > )); > Ok let's call_user_method_array() to give the parameters, but how to sort the > hach array from the MSL parsing, to fit into a numeric array where parameters > should be given in the correct order? > > What would be the proper solution? I think call_user_func_array is what you are looking for. > Orig: > function addWaveFilter($iAmplitude = 1, $iFrequenzy = 1) > { > if (!imagick_wave($this->_rHandle, $iAmplitude, $iFrequenzy)) { > return $this->_createError(IMAGE_IMAGICK_ERROR_SFX_FAILED); > } > return true; > } > Suggestion: > function wave($params = array('amplitude' => 2, 'wavelength' => > 4)) > { > if (!imagick_wave($this->_rHandle, > $params['amplitude'], > $params['wavelength'])) { > return $this->_createError(IMAGE_MAGICK_ERROR_FAILED_SFX); > } > return true; > } > This one would be just perfect for Conjure as Alan Knowles suggested, > but what about a direct call? Wouldn't it be a disadvantage? I don't get the whole point. Why do you want to wrap parameters into an array?

« previous php.pear.dev (#28856) next »