Leaderboard
Popular Content
Showing content with the highest reputation on 08/14/2013 in all areas
-
Btw, let me clarify one thing; with the exception of "name" [not title] all PW fields are custom fields . The title field in the default install is also a custom field, included with the default profile and "marked" as a global field, hence its appearance everywhere.. How you go about this really depends on a number of things. For instance, do you want each of those projects to have a URL? If so, then each has to be a page. If not, they can all go in one page but that may not be very versatile. So, here's one way of doing it: Note that PW fields are reusable. Create an image field called whatever you want (as per the naming rules for fields). Configure it to either accept only 1 image or multiple depending on your needs. Let's call the field "image" [single image field] or "images" [multiple image field] Create a template file called "projects.php" Create a template and associate it with the "projects.php" template file. Add the "image" [or "images"] field to it. If you are using PW default install you will already have the title field attached to this template since it is marked as "Global". If you want a field to contain text, e.g. a write-up about your projects, then create a text area field and add it to this template. If you will have other pages not related to projects, you may want to group your project pages into one "container", i.e. under one parent. So, go ahead and create a page called "projects". You can make it use the template "projects" or another template [all depends on how you code your template file] For each of your 5 projects, create child pages under the parent page "projects". Call them whatever you wish. Make sure these child pages use the "projects" template. Edit the child pages as you create them, adding a project image [or images] depending on the type of image field you created above. Enter a title and save each page. Now comes the fun part. Go into your template file and use a PW selector to grab and display those project child pages. I suppose in your parent projects page, what you want are links to your 5 projects. The HTML is of course up to you. You could do something like this. $projects = $pages->find('parent=projects');// this will give you all the children of the parent project page with the title "projects". If you wont have a lot of projects, no need to place a limit here on the amount of results you retrieve. Now, the call above will retrieve an array (more than one result returned)...Traverse the array using foreach. With that single call, you have access to everything about those child pages - their custom fields, etc... So, we use foreach to traverse the array...E.g. foreach ($projects as $project) { /*do something. What you want to do depends on you. Do you want to echo the project pages' titles? Do you want to echo a thumbnail of their images? Have a read of the project walkabout in the wiki as well as have a look at the default PW install. If you are still stuck, feel free to ask. */ } Small Project walkthrough Hope this helps5 points
-
--------------------------------------------------------------------------------------------------------------------------------- when working with PW version 2.6+, please use Pim2, not Pim! read more here on how to change from the older to the newer version in existing sites --------------------------------------------------------------------------------------------------------------------------------- PageImage Manipulator, API for version 1 & 2 The Page Image Manipulator is a module that let you in a first place do ImageManipulations with your PageImages. - And in a second place there is the possibility to let it work on any imagefile that exists in your servers filesystem, regardless if it is a 'known PW-image'. The Page Image Manipulator is a Toolbox for Users and Moduledevelopers. It is written to be as close to the Core ImageSizer as possible. Besides the GD-filterfunctions it contains resize, crop, canvas, rotate, flip, sharpen, unsharpMask and 3 watermark methods. How does it work? You can enter the ImageManipulator by calling the method pim2Load(). After that you can chain together how many actions in what ever order you like. If your manipulation is finished, you call pimSave() to write the memory Image into a diskfile. pimSave() returns the PageImage-Object of the new written file so we are able to further use any known PW-image property or method. This way it integrates best into the ProcessWire flow. The three examples above put out the same visual result: a grayscale image with a width of 240px. Only the filenames will slightly differ. You have to define a name-prefix that you pass with the pimLoad() method. If the file with that prefix already exists, all operations are skipped and only the desired PageImage-Object gets returned by pimSave(). If you want to force recreation of the file, you can pass as second param a boolean true: pim2Load('myPrefix', true). You may also want to get rid of all variations at once? Than you can call $pageimage->pim2Load('myPrefix')->removePimVariations()! A complete list of all methods and actions are at the end of this post. You may also visit the post with tips & examples for users and module developers. How to Install Download the module Place the module files in /site/modules/PageImageManipulator/ In your admin, click Modules > Check for new modules Click "install" for PageImageManipulator Done! There are no configuration settings needed, just install and use it. Download (version 0.2.0) get it from the Modules Directory History of origins http://processwire.com/talk/topic/3278-core-imagemanipulation/ ---------------------------------------------------------------------------------------------------------- Page Image Manipulator - Methods * pimLoad or pim2Load, depends on the version you use! pimLoad($prefix, $param2=optional, $param3=optional) param 1: $prefix - (string) = mandatory! param 2: mixed, $forceRecreation or $options param 3: mixed, $forceRecreation or $options return: pim - (class handle) $options - (array) default is empty, see the next method for a list of valid options! $forceRecreation - (bool) default is false It check if the desired image variation exists, if not or if forceRecreation is set to true, it prepares all settings to get ready for image manipulation ------------------------------------------------------------------- * setOptions setOptions(array $options) param: $options - (array) default is empty return: pim - (class handle) Takes an array with any number valid options / properties and set them by replacing the class-defaults and / or the global config defaults optionally set in the site/config.php under imageSizerOptions or imageManipulatorOptions. valid options are: quality = 1 - 100 (integer) upscaling = true | false (boolean) cropping = true | false (boolean) autoRotation =true | false (boolean) sharpening = 'none' | 'soft' | 'medium' | 'strong' (string) bgcolor = (array) css rgb or css rgba, first three values are integer 0-255 and optional 4 value is float 0-1, - default is array(255,255,255,0) thumbnailColorizeCustom = (array) rgb with values for colorize, integer -255 - 255 (this can be used to set a custom color when working together with Thumbnails-Module) outputFormat = 'gif' | 'jpg' | 'png' (Attention: outputFormat cannot be specified as global option in $config->imageManipulatorOptions!) set {singleOption} ($value) For every valid option there is also a single method that you can call, like setQuality(90), setUpscaling(false), etc. ------------------------------------------------------------------- * pimSave pimSave() return: PageImage-Object If a new image is hold in memory, it saves the current content into a diskfile, according to the settings of filename, imagetype, targetFilename and outputFormat. Returns a PageImage-Object! ------------------------------------------------------------------- * release release() return: void (nothing) if you, for what ever reason, first load image into memory but than do not save it, you should call release() to do the dishes! ? If you use pimSave() to leave the ImageManipulator, release() is called automatically. ------------------------------------------------------------------- * getOptions getOptions() return: associative array with all final option values example: ["autoRotation"] bool(true) ["upscaling"] bool(false) ["cropping"] bool(true) ["quality"] int(90) ["sharpening"] string(6) "medium" ["targetFilename"] string(96) "/htdocs/site/assets/files/1124/pim_prefix_filename.jpg" ["outputFormat"] string(3) "jpg" get {singleOption} () For every valid option there is also a single method that you can call, like getQuality(), getUpscaling(), etc. See method setOptions for a list of valid options! ------------------------------------------------------------------- * getImageInfo getImageInfo() return: associative array with useful informations of source imagefile example: ["type"] string(3) "jpg" ["imageType"] int(2) ["mimetype"] string(10) "image/jpeg" ["width"] int(500) ["height"] int(331) ["landscape"] bool(true) ["ratio"] float(1.5105740181269) ["bits"] int(8) ["channels"] int(3) ["colspace"] string(9) "DeviceRGB" ------------------------------------------------------------------- * getPimVariations getPimVariations() return: array of Pageimages Collect all pimVariations of this Pageimage as a Pageimages array of Pageimage objects. All variations created by the core ImageSizer are not included in the collection. ------------------------------------------------------------------- * removePimVariations removePimVariations() return: pim - (class handle) Removes all image variations that was created using the PIM, all variations that are created by the core ImageSizer are left untouched! ------------------------------------------------------------------- * width width($dst_width, $sharpen_mode=null) param: $dst_width - (integer) param: $auto_sharpen - (boolean) default is true was deleted with version 0.0.8, - sorry for breaking compatibility param: $sharpen_mode - (string) possible: 'none' | 'soft' | 'medium' | 'strong', default is 'soft' return: pim - (class handle) Is a call to resize where you prioritize the width, like with pageimage. Additionally, after resizing, an automatic sharpening can be done with one of the three modes. ------------------------------------------------------------------- * height height($dst_height, $sharpen_mode=null) param: $dst_height - (integer) param: $auto_sharpen - (boolean) default is true was deleted with version 0.0.8, - sorry for breaking compatibility param: $sharpen_mode - (string) possible: 'none' | 'soft' | 'medium' | 'strong', default is 'soft' return: pim - (class handle) Is a call to resize where you prioritize the height, like with pageimage. Additionally, after resizing, an automatic sharpening can be done with one of the three modes. ------------------------------------------------------------------- * resize resize($dst_width=0, $dst_height=0, $sharpen_mode=null) param: $dst_width - (integer) default is 0 param: $dst_height - (integer) default is 0 param: $auto_sharpen - (boolean) default is true was deleted with version 0.0.8, - sorry for breaking compatibility param: $sharpen_mode - (string) possible: 'none' | 'soft' | 'medium' | 'strong', default is 'soft' return: pim - (class handle) Is a call to resize where you have to set width and / or height, like with pageimage size(). Additionally, after resizing, an automatic sharpening can be done with one of the three modes. ------------------------------------------------------------------- * stepResize stepResize($dst_width=0, $dst_height=0) param: $dst_width - (integer) default is 0 param: $dst_height - (integer) default is 0 return: pim - (class handle) this performs a resizing but with multiple little steps, each step followed by a soft sharpening. That way you can get better result of sharpened images. ------------------------------------------------------------------- * sharpen sharpen($mode='soft') param: $mode - (string) possible values 'none' | 'soft'| 'medium'| 'strong' return: pim - (class handle) Applys sharpening to the current memory image. You can call it with one of the three predefined pattern, or you can pass an array with your own pattern. ------------------------------------------------------------------- * unsharpMask unsharpMask($amount, $radius, $threshold) param: $amount - (integer) 0 - 500, default is 100 param: $radius - (float) 0.1 - 50, default is 0.5 param: $threshold - (integer) 0 - 255, default is 3 return: pim - (class handle) Applys sharpening to the current memory image like the equal named filter in photoshop. Credit for the used unsharp mask algorithm goes to Torstein Hønsi who has created the function back in 2003. ------------------------------------------------------------------- * smooth smooth($level=127) param: $level - (integer) 1 - 255, default is 127 return: pim - (class handle) Smooth is the opposite of sharpen. You can define how strong it should be applied, 1 is low and 255 is strong. ------------------------------------------------------------------- * blur blur() return: pim - (class handle) Blur is like smooth, but cannot called with a value. It seems to be similar like a result of smooth with a value greater than 200. ------------------------------------------------------------------- * crop crop($pos_x, $pos_y, $width, $height) param: $pos_x - (integer) start position left param: $pos_y - (integer) start position top param: $width - (integer) horizontal length of desired image part param: $height - (integer) vertical length of desired image part return: pim - (class handle) This method cut out a part of the memory image. ------------------------------------------------------------------- * canvas canvas($width, $height, $bgcolor, $position, $padding) param: $width = mixed, associative array with options or integer, - mandatory! param: $height = integer, - mandatory if $width is integer! param: $bgcolor = array with rgb or rgba, - default is array(255, 255, 255, 0) param: $position = one out of north, northwest, center, etc, - default is center param: $padding = integer as percent of canvas length, - default is 0 return: pim - (class handle) This method creates a canvas according to the given width and height and position the memory image onto it. You can pass an associative options array as the first and only param. With it you have to set width and height and optionally any other valid param. Or you have to set at least width and height as integers. Hint: If you want use transparency with rgba and your sourceImage isn't of type PNG, you have to define 'png' as outputFormat with your initially options array or, for example, like this: $image->pimLoad('prefix')->setOutputFormat('png')->canvas(300, 300, array(210,233,238,0.5), 'c', 5)->pimSave() ------------------------------------------------------------------- * flip flip($vertical=false) param: $vertical - (boolean) default is false return: pim - (class handle) This flips the image horizontal by default. (mirroring) If the boolean param is set to true, it flips the image vertical instead. ------------------------------------------------------------------- * rotate rotate($degree, $backgroundColor=127) param: $degree - (integer) valid is -360 0 360 param: $backgroundColor - (integer) valid is 0 - 255, default is 127 return: pim - (class handle) This rotates the image. Positive values for degree rotates clockwise, negative values counter clockwise. If you use other values than 90, 180, 270, the additional space gets filled with the defined background color. ------------------------------------------------------------------- * brightness brightness($level) param: $level - (integer) -255 0 255 return: pim - (class handle) You can adjust brightness by defining a value between -255 and +255. Zero lets it unchanged, negative values results in darker images and positive values in lighter images. ------------------------------------------------------------------- * contrast contrast($level) param: $level - (integer) -255 0 255 return: pim - (class handle) You can adjust contrast by defining a value between -255 and +255. Zero lets it unchanged, negative values results in lesser contrast and positive values in higher contrast. ------------------------------------------------------------------- * grayscale grayscale() return: pim - (class handle) Turns an image into grayscale. Remove all colors. ------------------------------------------------------------------- * sepia sepia() return: pim - (class handle) Turns the memory image into a colorized grayscale image with a predefined rgb-color that is known as "sepia". ------------------------------------------------------------------- * colorize colorize($anyColor) param: $anyColor - (array) like css rgb or css rgba - but with values for rgb -255 - +255, - value for alpha is float 0 - 1, 0 = transparent 1 = opaque return: pim - (class handle) Here you can adjust each of the RGB colors and optionally the alpha channel. Zero lets the channel unchanged whereas negative values results in lesser / darker parts of that channel and higher values in stronger saturisation of that channel. ------------------------------------------------------------------- * negate negate() return: pim - (class handle) Turns an image into a "negative". ------------------------------------------------------------------- * pixelate pixelate($blockSize=3) param: $blockSize - (integer) 1 - ??, default is 3 return: pim - (class handle) This apply the well known PixelLook to the memory image. It is stronger with higher values for blockSize. ------------------------------------------------------------------- * emboss emboss() return: pim - (class handle) This apply the emboss effect to the memory image. ------------------------------------------------------------------- * edgedetect edgedetect() return: pim - (class handle) This apply the edge-detect effect to the memory image. ------------------------------------------------------------------- * getMemoryImage getMemoryImage() return: memoryimage - (GD-Resource) If you want apply something that isn't available with that class, you simply can check out the current memory image and apply your image - voodoo - stuff ------------------------------------------------------------------- * setMemoryImage setMemoryImage($memoryImage) param: $memoryImage - (GD-Resource) return: pim - (class handle) If you are ready with your own image stuff, you can check in the memory image for further use with the class. ------------------------------------------------------------------- * watermarkLogo watermarkLogo($pngAlphaImage, $position='center', $padding=2) param: $pngAlphaImage - mixed [systemfilepath or PageImageObject] to/from a PNG with transparency param: $position - (string) is one out of: N, E, S, W, C, NE, SE, SW, NW, - or: north, east, south, west, center, northeast, southeast, southwest, northwest default is 'center' param: $padding - (integer) 0 - 25, default is 5, padding to the borders in percent of the images length! return: pim - (class handle) You can pass a transparent image with its filename or as a PageImage to the method. If the watermark is bigger than the destination-image, it gets shrinked to fit into the targetimage. If it is a small watermark image you can define the position of it: NW - N - NE | | | W - C - E | | | SW - S - SE The easiest and best way I have discovered to apply a big transparency watermark to an image is as follows: create a square transparent png image of e.g. 2000 x 2000 px, place your mark into the center with enough (percent) of space to the borders. You can see an example here! The $pngAlphaImage get centered and shrinked to fit into the memory image. No hassle with what width and / or height should I use?, how many space for the borders?, etc. ------------------------------------------------------------------- * watermarkLogoTiled watermarkLogoTiled($pngAlphaImage) param: $pngAlphaImage - mixed [systemfilepath or PageImageObject] to/from a PNG with transparency return: pim - (class handle) Here you have to pass a tile png with transparency (e.g. something between 150-300 px?) to your bigger images. It got repeated all over the memory image starting at the top left corner. ------------------------------------------------------------------- * watermarkText watermarkText($text, $size=10, $position='center', $padding=2, $opacity=50, $trueTypeFont=null) param: $text - (string) the text that you want to display on the image param: $size - (integer) 1 - 100, unit = points, good value seems to be around 10 to 15 param: $position - (string) is one out of: N, E, S, W, C, NE, SE, SW, NW, - or: north, east, south, west, center, northeast, southeast, southwest, northwest default is 'center' param: $padding - (integer) 0 - 25, default is 2, padding to the borders in percent of the images length! param: $opacity- (integer) 1 - 100, default is 50 param: $trueTypeFont - (string) systemfilepath to a TrueTypeFont, default is freesansbold.ttf (is GPL & comes with the module) return: pim - (class handle) Here you can display (dynamic) text with transparency over the memory image. You have to define your text, and optionally size, position, padding, opacity for it. And if you don't like the default font, freesansbold, you have to point to a TrueTypeFont-File of your choice. Please have a look to example output: http://processwire.com/talk/topic/4264-release-page-image-manipulator/page-2#entry41989 ------------------------------------------------------------------- PageImage Manipulator - Example Output3 points
-
@Soma...Thanks! Well you and the other "usual suspects" are squarely to "blame" for slowly turning me into a coder ! I have recently had the "aha" moment regarding module development; I couldn't agree more - PW makes it so very easy to develop modules! The API is consistent and there's tools for almost everything (well-done Ryan!). Looking at the module code written by you guys now makes much more sense to me. Teppo's write-up on Inputfields and Fieldtypes was one of the tipping points for me; that plus I looked up some really nice and short PHP OOP tutorials. Suddenly, it all made sense . I feel like I've learnt a lot in such a short time, thanks to you guys leading the way . Anyway, I will be doing a write-up sometime about my experiences in module development so watch this space. About "energy", incidentally, I was thinking about that recently; about that time when you feel you've "coded it all" and need something different to excite you. Anyway, I digress. Thanks for offering to test. Looking forward to your suggestions3 points
-
Have you deleted cache? /site/assets/cache/ ? I don't know why MarkupSimpleNavigation wouldn't load.2 points
-
It seems like ProcessWire can not load the module, so calling the render() method causes this error. Try this: Uninstall and install the MarkupSimpleNavigation moduleAlso make sure that you uploaded all files + migrated the complete database to your live server. Btw, no need to call the module with all those options. These are the default options that the module will use. Just specify the ones you need to differ from the default ones.2 points
-
ProcessWire Productivity App QuickSilver Getting things done QUICK Sequel Pro The easiest way to handle local databases Little Ipsum Never outta reach. Sip Live's so colorfull....2 points
-
Hi all, I'm a big fan of the Sublime Text 2 text editor and of course of huge fan of ProcessWire, so I went ahead and created a library of PW snippets to be used with the ST2 Snippet system. I followed the PW cheat sheet, and created Advanced and Basic versions. The Advanced version contains only those seen in the advanced mode of the cheat sheet, so if you want the full set, you'll want to get both Basic and Advanced. They are on GitHub here: https://github.com/evanmcd/SublimeProcessWireSnippetsBasic https://github.com/evanmcd/SublimeProcessWireSnippetsAdvanced I've just submitted the Advanced set for inclusion into Package Manager, so hopefully that will be added soon. See the README for more info. Any feedback welcomed1 point
-
Hey, after many questions here in the forums, (by the way, thank you for the great, fast and straightforward support) we would like to show one of our projects, which we realized using to awesome Processwire. A designer friend of us asked us to transfer one of her webdesigns into a running website. The customer is one of Germany's most experienced and well-known horse transportation companies. The multilingual website is based on Processwire and should be completely responsive, so please feel free to resize your browser or view it on your smartphone or tablet. http://www.johannsmann-pferdetransporte.de Currently the customer is about to fill the website with more data. So please don't mind, if some pages are not complete. Every comment is welcome - either suggestions or constructive criticism. Thank you so much for this great project and this stunning community!1 point
-
I think you've done a good job overall, it's certainly a design that will appeal to the audience more than fellow designers. One thing I'm not a huge fan of is changing a font-weight or font-style on hover, as is the case with the menu. It changes the space an element takes up and I think detracts from the experience. I always prefer working with subtle colour changes if possible.1 point
-
Yes, that's better. Beyond creating the directory for you if it doesn't already exist, it's also good to note that the directory might not literally be the $page->id. If you've got the $config->pagefileSecure=true; option in your /site/config.php, then unpublished and non-guest-accessible pages will have file directories that start with a period, in order to prevent web access, i.e. ".123" rather than "123". Using the $page->filesManager->path or $page->[your file field]->path, rather than constructing it yourself, ensures that all of this continues to work as it should.1 point
-
I used to run into strange issues too - also with other systems when transferring files one-by-one. Nowadays I zip locally and transfer the zip and unzip it on the server. This way I can be sure all the rights, files, et cetera will be transferred.1 point
-
That was VERY helpful and pretty much solved my problem. Thanks for the advice! I will post the update after I finish everything1 point
-
Hi Meepz. Welcome to the forums and the wonderful world of PW Not sure how much you've read of the docs. You want to start there if you haven't. Things will then make a lot more sense. Selectors and page(s) variables are a must read . Check this part of the docs to know how to access images. This thread has links to great resources, tutorials and articles. OK, back to your question... If you had that image as inline in your text, then all you need to do in your template file is to echo echo $page->project; If you had the image in an image custom field that could only take one image, in your template file you could have: echo $page->project;//contains your text if($page->image) echo "<img src='{$page->image->url}'>"; //where image is your image field There are other ways to achieve this; I'm just giving you basic examples here..1 point
-
Also wanted to dive in and say hello. I like coffee. Seriously great stuff, and you're right my DataTables module is only an example and it was a rough coding session never found any more love. But actually to just read and list data with quick edit link in a modal, which is nice for when editing sets of items, and I'm using it in some projects. It would also support inline editing and stuff but never found the energy and time to give it a shot. Making everything configurable and modular/abstract is quite some work, so all the love for people taking this "concept" further. I think there's a need for such things and I love seeing other people getting involved with PW module development. There's so many good things that can be done and PW makes it so easy. But dude that Handsontable is a real beauty and looks like a great concept and API! Keep it up. Thanks for sharing. The right tools make a big difference. If you need a beta tester...1 point
-
Hi Blackeye. Welcome to PW and the forums Creating pages with upload: As for creating a page and adding images, you are on your way... call the method for creating a new page - new Page(); get its template get its parent add a title save add image save all via the API...Make sure to sanitize all your form values.. see the examples on this page: http://processwire.com/api/variables/pages/ wireUpload: See these http://processwire.com/talk/topic/1809-image-upload-via-wireupload/ http://processwire.com/talk/topic/3105-create-pages-with-file-upload-field-via-api/ http://processwire.com/talk/topic/197-import-images-from-file-system-using-the-pw-api/ There's numerous other examples in the forums . See also these snippets: https://gist.github.com/somatonic1 point
-
Apeisa, Thanks for sharing your approach, I'm just now getting a chance to really dissect it. I have been doing something kind of similar, but not quite as clean as your method. It still relied heavily on a naming convention for pages/templates. Setting the view via $page->layout allows for the flexibility I need, without having to worry about naming. Cheers!1 point
-
thanks Wanze! Hhm, I think: no! :P I prefer to use photoshop directly with a wrapper class that uses the COM-technique on Windows1 point
-
To use a honeypot I use the following code. Works like a charm and never ever get spam send through the forms on several websites. 1. First I add the checkbox $field = $modules->get('InputfieldCheckbox'); $field->label = "Stuur een e-mail"; $field->attr('id+name','sendemail'); $form->append($field); 2. When processing the field find the spam field and set the error // Get the form field $spamField = $form->get("sendemail"); // Get the spam action $spamAction = $sanitizer->text($input->post->sendemail); // If the spamAction is true tell the bot to try again if ($spamAction == 1) { $spamField->error("Please try again!"); } 3. Hide the field with CSS .Inputfield_sendemail { display: none !important; }1 point
-
Hi all, Just to let you know that Wanze and I are now working on this (or rather, he's doing most of the coding and am doing the talking ). We concluded it was best to (first) develop a PW Handsontable class that other modules can load, configure settings and use its methods to render CRUD tables. This way, the class can be integrated into other modules as required, e.g. Batcher and use all or only some of its methods, e.g. limited CRUD, readOnly, etc. At this stage, this means that the module is primarily for developers since there is no UI to configure it. However, once the class has been tested, a Process Module should follow. You can follow the project here: https://github.com/wanze/PwHandsontable. Suggestions welcome, thanks!1 point
-
It took me a little while to work out exactly what this meant. Given that this is talking about moving the default homepage from the top of the tree it wasn't immediately clear to me which homepage template diogo and Ryan were talking about above. So just to be clear, my understanding is that what you would do is create a template for the page at the top of the tree - which need contain nothing more than Ryan's code above. You would then create a new "home page" template for the page you actually want to be the home page. Perfectly logical when you think about it - but I'm a bit slow1 point
-
if "Maximum files allowed" was set to 1, the module was not able to get the image. (ADMIN > SETUP > FIELDS > imagefield ) Latest update fixed this bug.1 point
-
@Wes, Confirm you are on dev version? Ryan's post is about that version1 point
-
It's a common error in coding and has nothing to do with PHP. I would write the loop and current class like this: foreach($categories as $category) { $class = $category === wire("page") ? ' class="current"' : ''; $out .="<li$class><a href='{$category->url}'>{$category->title}</a></li>"; } === is comparing the objects if they're the same in memory, since $category at some point IS the current $page it works. You could also write: foreach($categories as $category) { $class = $category->id == wire("page")->id ? ' class="current"' : ''; $out .="<li$class><a href='{$category->url}'>{$category->title}</a></li>"; } No need to compare titles as they theoretically could be same for another page. So the id is just as good and better.1 point
-
PageImage Manipulator - Tips & Examples * how to create a PNG with transparency for the watermarkLogo method If you can use adobe photoshop, you simply may download and install this action: photoshop_action_PW-png-creations.zip create an empty image (transparent, not white or black) of 2000 x 2000 pixel write / paste your text and / or logo in a single color, (e.g. black) when finished with your text you should have one single layer with text on transparent background then click the action PW-png-creations -> 2000px-square-to-smooth and you are done. Hhm, maybe before saving you want to tweak the global transparency of the image a bit. That one used in the ProcessWire example was set to 75% instead of 100%. Just try out what looks best for you. ------------------------------------------------------------------- * did you know that you can save to different file formats, regardless of source format? You only have to specify your desired format (gif, jpg, png) with the optionally options array with a key named outputFormat and pass it with your call to pimLoad() or use setOptions() before any other action-method: // assuming the first image is a jpeg $img = $page->images->first(); // define outputFormat $options = array('outputFormat'=>'png'); // apply it together with other actions $myPng = $img->pimLoad('myPrefix')->setOptions($options)->width(240)->pimSave(); //------------------------------------------------------------------------------------------ // you may also do it as a OneLiner only with the image format conversion $myPng = $page->images->eq(0)->pimLoad('myPrefix', array('outputFormat'=>'png'))->pimSave(); // or you can use the setOutputFormat method $myPng = $page->images->first()->pimLoad('myPrefix')->setOutputFormat('png')->pimSave(); ------------------------------------------------------------------- * (how) can I use the ImageManipulator with other imagefiles than PW-Pageimages? You can load any imagefile from your servers filesystem into the ImageManipulator with: $pim = wire('modules')->get('PageImageManipulator')->imLoad($imageFilename); // or $pim = $wire->modules->get('PageImageManipulator')->imLoad($imageFilename, $options); You can directly with the imLoad-method pass specific $options or you can do a separate call to setOptions(). Then you do your desired actions and last but not least you call save()! Most time I think the original passed file gets overwritten with the manipulation result, but you are also able to save to a different name and / or fileformat. If so, it is useful to get the final (sanitized) filename back after saveing. $optionalNewFilename = $pim->setOptions($options)->height(360)->flip()->blur()->save(); Also you may call this in one line if you prefer: if(false!==$wire->modules->get('PageImageManipulator')->imLoad($imageFilename,$options)->height(360)->flip()->blur()->save()) { // success !! } ------------------------------------------------------------------- * how can I use the PageImageManipulator with my own module/s? If you build a module that do some image manipulation you can define the PIM as needed dependency in your ModulesInfo method with the key 'requires'. You may also force to install the PIM if it isn't already with the key 'installs': public static function getModuleInfo() { return array( // ... 'requires' => array('PageImageManipulator'), 'installs' => 'PageImageManipulator', // ... ); } detailed infos are here: http://processwire.com/talk/topic/778-module-dependencies/ additionally, if you need to check if a module dependency has a minimum version number, you can do it in your install method like this: public function ___install() { // check that at least the minimum version number is installed $needed = '0.0.3'; $a = wire('modules')->get('PageImageManipulator')->getModuleInfo(); $actual = preg_replace('/(\d)(?=\d)/', '$1.', str_pad("{$a['version']}", 3, "0", STR_PAD_LEFT)); if(version_compare($actual, $needed, '<')) { throw new WireException(sprintf($this->_(__CLASS__ . " requires PageImageManipulator %s or newer. Please update."), $needed)); return; } // ... more code } ------------------------------------------------------------------- * global options in site/config.php You can create a config-array in your site/config.php. If you look into it you will find a config array for the ImageSizer that comes with the PW core $config->imageSizerOptions = array( 'autoRotation' => true, 'sharpening' => 'soft', 'upscaling' => true, 'cropping' => true, 'quality' => 90 ); You can define another array with these keys: $config->imageManipulatorOptions = array( 'autoRotation' => true, 'sharpening' => 'soft', 'upscaling' => false, 'cropping' => true, 'quality' => 90, 'bgcolor' => array(255,255,255,0), ); You don't have to specify all of the options. PiM reads the imageSizerOptions and merge them with the imageManipulatorOptions. So if you want to have different values you can specify them in imageManipulatorOptions to override those from imageSizerOptions. Only one option isn't present with the imageSizer: bgcolor. This is only used by the imageManipulator. ------------------------------------------------------------------- * using PiM together with the awesome Thumbnails Module (http://mods.pw/1b) If you use the Thumbnails Module together with PiM, you can set two options in the site/config.php under imageManipulatorOptions: $config->imageManipulatorOptions = array( // ... 'thumbnailColorizeCustom' => array(40,-35,0), 'thumbnailCoordsPermanent' => true ); For the colorize dropdown select you can define the custom color here and with the second param you enable/disable permanent storage of RectangleCoords and params. The coords and params are stored with Thumbnails Module per session, but are lost after the session is closed. If you enable permanent storage these data is written into a custom IPTC field of the original imagefile. ------------------------------------------------------------------- * some more examples will folow here . . . -------------------------------------------------------------------1 point
-
Something that's in dev since 2.3.1 is that you can make the autoload specific. More infos can found here http://processwire.com/talk/topic/3768-processwire-231-dev-branch/ : 3. Conditional autoload modules. This is because if you look at your module, it will get loaded and hook added in init on EVERY request, even on front-end. So to make this easy you can use a selector or an anonymous function (php 5.3 only). To only load this module in the admin, you could then do "autoload" => "template=admin",1 point
-
@onjegolders Using a module to implement the unique number was a good opportunity for me to learn more about fieldtypes, not necessarily because it is the most straightforward solution. I really want to get to know the internals of Processwire better, but normally don't have enough time beside work to read up on the documentation. So I am actively looking for opportunities to implement something new. Cheers, Stefan1 point
-
currently I'm back working on the ImageManipulator. I've put it into a module that extends PageImage. It integrates nicely into PWs workflow. There are only a few things that I have to solve before I can release it: finishing and testing the watermark-methods write documentation and some examples provide support for imageVariations, namely: removeVariations() with point 3, I already have a method that can be called when in PIM-mode (PageImageManipulator-mode) which unlink all PIM-created files, but I think it would be more comfortable if a user calls one of the PageImage-methods getVariations() or removeVariations() if the PIM-created variations are included in the collections. EDIT: in the meantime, we have had a release already: http://processwire.com/talk/topic/4264-release-page-image-manipulator/ ----- here are a screenshot of my current Testpage1 point
-
Went yesterday to the cinema to see "Drupal & Joomla 6", and was not disappointed. Highly recommended!1 point