-
Posts
4,090 -
Joined
-
Last visited
-
Days Won
88
Everything posted by horst
-
When working on ImageEditor (formerly named ImageManipulation) I come across some points that I want to [ discuss | get advice | point out ] ----- 1) The ImageEditor now can be used like this: $myImage = $page->images->first; $imedit = new ImageEditor($myImage); if($imedit->imRotate(90)->imResize(300,0,false)->imSharpen('soft')->imSave()) { echo '<img src="'.$myImage->url.'" />'; } It needs a PageImage as source. This can be an original Image, but than it needs a targetFilename, because it doesn't allow to overwrite the original Image! When it gets an ImageVariation it can save to that filename (overwrite). You also may save to another image format, e.g. your source is JPEG and you apply some alpha masking vodoo to it, you want to save it as PNG. This can be done by define the optional option outputFormat. ----- 2) I think there is a need for a additional Image Method: $image->nameAppendix() or something like that because there is allready a naming convention for images ( originalimagename.300x0.jpg or originalimagename.0x300.jpg ) that could be extended to something like originalimagename . 300x0 (userdefinedAppendixWrappedBySpecialChars) .jpg The $image->nameAppendix('userDefinedAppendix') should set or exchange this filename part. This would be of great help to keep imagenames consistent across the site. I have read a thread where Ryan has said that when trying do delete all Variations of a site that cannot be done by iterating through $images and use ->removeVariations() for large sites. On the other hand when users or module authors can name the images without be restricted that may become a mess with imagenames. At least there should be defined a image naming convention with respect to UserNameAppendices, - than I can implement it into the ImageEditor. ----- 3) I need some advice on how to handle Errors & Warnings, e.g. when not all needed options are passed, or they aren't valid. Should we silently use defaultValues where available or should we use that and write to ErrorLogFile. Don't know how fast a Logfile can grow, or even more terrible, - when should I throw an Exception? When gets an admin email invoked? I can upload the code or provide otherwise more informations on that. Please ask / tell what is needed. ----- 4) Here are some examples / possibilities of usage: $myImage = $page->images->first; $imedit = new ImageEditor($myImage); output of $imedit->image : array(10) { ["type"] string(3) "jpg" ["imageType"] int(2) ["mimetype"] string(10) "image/jpeg" ["width"] int(1800) ["height"] int(1196) ["landscape"] bool(true) ["ratio"] float(1.505016722408) ["bits"] int(8) ["channels"] int(3) ["colspace"] string(9) "DeviceRGB" } $myImage = $page->images->first; $imedit = new ImageEditor($myImage, $options); //second param is optional $options array like with ImagesSizer /** * valid options, identical to that 5 from (new) ImageSizer, * width 3 additions: targetFilename and outputFormat * * - targetFilename is needed because we don't want to overwrite the original Imagefile * there are two exceptions: * 1) if you have allready created a variation and have passed that to the ImageEditor * than a targetFilename is not needed. * (we check reference '$image->original' to know about that) * 2) using the static function fileAutoRotation, because this is mainly implemented * for correcting an original imagefile on upload! So a file gets uploaded only one * time and only then we may apply rotation to the original image. * * - outputFormat is optional and only should give ability to * import for example a JPEG, do something with fancy masking and * save it to PNG-Format with alpha transparency. * * - bgcolor may be used when wrapping borders around an image or create Thumbnails like Slides * (squares with landscapes or portraits in it) * */ protected $optionNames = array( 'autoRotation', 'upscaling', 'cropping', 'quality', 'sharpening', 'bgcolor', 'targetFilename', 'outputFormat' ); // you may also at any point get out the memoryimage, apply your own stuff like a SepiaFilter and put it back: $myImage = $page->images->first; $imedit = new ImageEditor($myImage); $im = $imedit->imRotate(90)->imResize(300,0,false)->imSharpen('soft')->imGetIm(); imagefilter($im,IMG_FILTER_GRAYSCALE); imagefilter($im,IMG_FILTER_COLORIZE,100,50,0); $imedit->imSetIm($im)->imSave(); // the OneLiner // this one should get invoked when an image is uploaded public static function fileAutoRotation( $filename, $quality=95 ) // and this one is a present for apeisa, (but pssst, don't tell him) public static function fileThumbnailModule( $filename, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h, $quality=95, $sharpening='medium' )
- 32 replies
-
- 1
-
-
- manipulation
- imagesizer
-
(and 3 more)
Tagged with:
-
No, this isn't suspicious, it's me saying skoal.
- 74 replies
-
- 8
-
-
- fields
- alter table
-
(and 1 more)
Tagged with:
-
( this is the community from Ryans point of view )
- 74 replies
-
- 4
-
-
- fields
- alter table
-
(and 1 more)
Tagged with:
-
Thanks for looking to this Ryan. So may I go to the wishlist and add a 'FieldtypeTextUnique' to it, or is it allready on a list you have?
- 74 replies
-
- fields
- alter table
-
(and 1 more)
Tagged with:
-
Thanks Ryan, - but I don't need it now with this module. It was just a to quick asked question. Anyway it's good to know for the future. I will go with the ConfigurableModule. But if one ask here on the forum it maybe that one get to much information for one's brain to handle / process / assimilate. But, just keep on with it guys!
- 9 replies
-
- module
- ConfigurableModule
-
(and 1 more)
Tagged with:
-
Maybe, but as of Thumbnails is a visual Tool, I wish to have it like in my dirty Hack. plus one additional feature: If you have created a Thumb and quality isn't what you have expected, when you go back to recreate it, the CropRectangle should be placed automaticaly at its place, so you have only to select a different quality and / or sharpening pattern. (Just a dream, - but sometimes they become true)
-
Ryan, did you find out something about that with the use of the language pack? I'm fine with the default admin theme, but language pack would be fine.
- 74 replies
-
- fields
- alter table
-
(and 1 more)
Tagged with:
-
Yes! That's really fun.
-
have had some hours last evening (exactly 8 'til now) I think I can finish the import next time I get 2-3 hours. So, don't know when now. There is some trouble with chars in filenames and ID3-Tags that want not get into the DB, so I have played around with sanitizer, but have to go deeper and change the current behave. Here are a screencast of the backend, starting with an empty DB (no mp3 data in it) set one or more pathes, do a quick filesystem scan (without parsing ID3 etc) envoke a command line script to perform scan with parsing mp3 files and pull data into DB: (please look fullscreen or otherwise enlarge Video) https://youtu.be/Re08fuNFRao
-
Hi Soma, I'm actually working on scanning filesystem and parse 5000 files for metadata. As I run into errors (e.g. not knowing to use $sanitizer->selectorValue()) I don't want to wait 3 minutes every loop, - so store a serialized array in cache-file (site/assets/cache/). I've asked to get a sense for the possibilities. Actually I only will use the ModuleConfigData-storage for some Path- and Extension-strings. Thanks, it only implements ConfigurableModule, so it must have Module allready. (will look into that closer) EDIT: have found this Post: http://processwire.com/talk/topic/1313-modules-process-and-the-difference/#entry11738
- 9 replies
-
- module
- ConfigurableModule
-
(and 1 more)
Tagged with:
-
Can I also use it with extending Process instead of WireData? class MyModule extends Process implements Module, ConfigurableModule { That's awesome! I will change that after finishing some other parts Is there a limit on size to store? For example can I store a serialized array of 5MB or are any bads with that ? Many thanks!
- 9 replies
-
- module
- ConfigurableModule
-
(and 1 more)
Tagged with:
-
Ryan, that's great! It's that kind of great things one will find lots when starting to work with PW. In the past there were so much things that couldn't achvied or only with clumpsy workarounds. I just have to learn to think more positive and first try to find the most simplest solution, than look into PW to realise that it is almost in, or sometimes to get surprised that there even is a more comfortable and easier solution than that I could imagine.
-
Thanks Luis. - so have to say: I only want put together the basic stuff but also want to keep it modular and scalable. For example I personally only use mp3-files but if people use other formats like ogg they should be able to extend the class module for that easily. Maybe with some help it could become really nice and not only poor basic ;-) If someone has good skills on how to build / design / layout admin pages with that UI-stuff it would be really helpful if he/she could design the output for the backend. Also if someone is good with frontend design and want to collaborate that would be great too. I have a really short screencast of what I have done till now, (most of this was learning how to send green or red messages to admin screen, how / where to store config data, to create permissions and roles, and basically how to create a module that has a page in the admin section, ...): https://youtu.be/u_S8ajLkzRI Next steps are to parse ID3Tags, compare file-data with DB-data and import new tracks. Question: is it possible to store arrays or WireData on a page?
-
Hi Soma, that's perfect for this needs, as I allready create a page for the module, I now also create a childpage for the config data. I have to learn to think less complicated when working with PW! I also have created 2 permissions and 2 roles to have access control. It tooks only 5 minutes for this! (Das ist so geil!) If I have not allready said it: I love ProcessWire!
- 9 replies
-
- 1
-
-
- module
- ConfigurableModule
-
(and 1 more)
Tagged with:
-
Hi, I create a little module that extends Process and creates a page in backend under setup. I need to store and retrieve a few (config)data for it, but don't want to make it a ConfigurableModule because than I have redundant places where I can setup config-data , I guess. How can I store / retrieve some data into the place where modules store it by default, but without implementing ConfigurableModule?
- 9 replies
-
- module
- ConfigurableModule
-
(and 1 more)
Tagged with:
-
Ooh, - now I've got it right: the problem are not the ImagePathes in Textareas but _all_ pathes because you setup different sites like http://localhost/mysite1/ , http://localhost/mysite2/ , ... --- You may use Apache with vHosts and generic names like: http://pw1.machine.local/ , http://pw2.machine.local/ , http://pw3.machine.local/ , ... --- Maybe one could use basic httpd.conf (without http-vhosts.conf) and edit two lines in it: #DocumentRoot "C:/Apache2/htdocs" DocumentRoot "C:/WEBSITES/pw1/htdocs" #DocumentRoot "C:/WEBSITES/pw2/htdocs" and #<Directory "C:/Apache2/htdocs"> <Directory "C:/WEBSITES/pw1/htdocs"> #<Directory "C:/WEBSITES/pw2/htdocs"> to match the systempath of the site you are actually working on? --- or you may have one Docroot and Directory in httpd.conf pointing to for example "C:/Apache2/website/htdocs" and in filesystem you have folders for your sites like C:/Apache2/website.PW1/htdocs C:/Apache2/website.PW2/htdocs C:/Apache2/website.PW3/htdocs and you alter the path to C:/Apache2/website/htdocs for the site you work on. This only needs one edit and Apache restart isn't necessary. --- I go with the vhosts
-
Great!
-
Hey Macrura, really nice that you want to help out! - But, with this id3 reading and writing stuff I'm allready perfectly equipped. - What would be good to have is functional mp3-streaming code. Playlistgeneration and ServersidePlaying (for win) is already in tha house, too.
-
Ah, I did know it: it was totally silly! --- I'm not sure, and I've forgotten the Genre-Field, but I think mostly I want to search for an Artist or an Album or a Genre, - or, what would be really nice: want to have 50 or any number random Tracks of specified Genre or Artist as playlist output.
-
Hi Wanze, many thanks for your suggestions! With the first one I'm not sure how to solve that. The second one would just reflect the filesystem. Not bad, because it's like i use it since ever --- But (maybe it's totally silly): could it be an option to have only one Template (Tracks) with the fields: Artist, Album, Trackname Tracknumber, and some other (tracklength, ...) and one record per mp3file? Or will this slow down PW by searching / sorting? (15 - 20.000 files) (I came up with this when thinking about how to solve your first suggestion)
-
sure!
-
Sorry, have no more ideas. It's up to the pro's here.
-
Hhm, that's a thing for the pro's. Only thing what comes to my mind is if you use an AdminTheme in your sites-folder you can do one test with it disabled (renamed) to see if the missing elements get suppressed by it. ??
-
Hi, I'm thinking on using PW to scan my MP3-folders and want ask how you would organize the data. I want to store 'Trackname', 'Artistname', and 'Albumname' & 'Tracknumber', if Track belongs to an Album. (most will do, but not all). I want to be able to do fast (Selector) searches and sortings on combinations of this fields. Any suggestions for a PW-newbie?
-
replace the complete wire folder with the new one, but keep the sites-folder unchanged (just delete / copy or rename to backup and copy new)