Jump to content

Macrura

PW-Moderators
  • Posts

    2,765
  • Joined

  • Last visited

  • Days Won

    40

Everything posted by Macrura

  1. just popping by to say that Tracy made it possible for me to convert an old site where i was using direct output, to a delayed output model, which i needed to be able to handle the new requirements of the site; in particular, the template path feature was crucial – i was able to simply duplicate each template one at a time, rename to -dev, and work on the conversion until it was ready... Also the new styling looks great!
  2. I have the same issue. The module was working great on 3.0.33, then i upgraded to 3.0.52 and the frontend method of getting the crop no longer works; the images are there in the folders with the suffix, and the backend stuff all works; just can't get the crops to output on the front end for some reason; the method is just returning null; I have another site on a different server where this is running on 3.0.52 and does work...
  3. ok sure - yeah, you can use it as is now if you hardcode the field names; (i will setup a proof of concept module shortly on GitHub to have a fully installable module..)
  4. ok - thanks - i will work on it and get it configurable, and do some more dummy testing...
  5. thanks again - i learned a lot from studying the migrator as well as your other modules... I'm surprised this hasn't come up before, as i would think it quite common for clients to paste in HTML to the editor with external image references; My one client was totally confused because they would paste in these reviews with all of the images, not realizing the images were being pulled from external sites, and then they couldn't click the images in the editor;
  6. right, if i copy your code more closely, then my function would be improved a lot...
  7. cool - yes, thanks almost have this working using your examples!, will post final code once it's tested... Edit: this is the new improved version for specific usage; could be improved a lot (basically copy the migrator code), with the try/catch in case the external image can't be retrieved, and also allow for some additional checks for image field, RTE field; for most applications i can just add this to my SiteUtilities module and enable it for some specific templates and fields... public function importExternalImages($event) { $page = $event->arguments[0]; $html = $page->body; if (strpos($html,'<img') === false) return; //return early if no images are embedded in html $dom = new \DOMDocument(); $dom->loadHTML(mb_convert_encoding($html, 'HTML-ENTITIES', 'UTF-8')); $images = $dom->getElementsByTagName('img'); if(!$images->length) return; // not needed? $assetsPath = $this->pages->get($page->id)->filesManager()->url(); $extCount = 0; foreach ($images as $image) { $img_url = $image->getAttribute('src'); if(!filter_var($img_url, FILTER_VALIDATE_URL)) continue; $page->images->add($img_url); if($image->getAttribute('title') != ''){ $page->images->last()->description = $image->getAttribute('title'); } elseif($image->getAttribute('alt') != ''){ $page->images->last()->description = $image->getAttribute('alt'); } //resize image to make version to match the size originally in the RTE //check to make sure size is different to downloaded version before resizing if($image->getAttribute('width') && $image->getAttribute('width') != $page->images->last()->width) { $imgForRte = $page->images->last()->size($image->getAttribute('width'), 0); } else { $imgForRte = $page->images->last(); } $image->setAttribute('src', $imgForRte->url); $extCount++; } if(!$extCount) return; $page->of(false); //$page->body = $dom->saveHTML(); $page->body = preg_replace('/^<!DOCTYPE.+?>/', '', str_replace( array('<html>', '</html>', '<body>', '</body>'), array('', '', '', ''), $dom->saveHTML())); $page->save('body'); $this->message("image links updated to local images."); $page->save('images'); $this->message("external images imported to page"); } thanks again for your help and advice!
  8. I'm working on a module that scans the textarea field and imports external images, and replaces the reference to them in the editor with the local version. This is the function that is hooked after Page save. Mods: http://modules.processwire.com/modules/import-external-images/ Github: https://github.com/outflux3/ImportExternalImages
  9. cool, in that case it should be easy, you just use that exact syntax, but add the 'group' key: $selector = array( array( 'field' => 'date_pub_end', 'operator' => '<=', 'value' => $now, ), array( 'field' => 'date_pub_end', 'operator' => '=' , 'value' => '', 'group' => 'foo' ), array( 'field' => 'date_pub_end', 'operator' => '>=', 'value' => $now, 'group' => 'foo' ), ); i theeenk
  10. I think the associative array option you may use either 'group' or 'or' to specify or-group, but i can't figure out how to do it, as the blog post that announced the feature doesn't explain how to do groups in selector arrays... do hope to find out how to do it soon... https://processwire.com/blog/posts/processwire-3.0.13-selector-upgrades-and-new-form-builder-version/#building-a-selector-string-with-user-input-example
  11. Here are some of the pre-configured cassette ui players:
  12. Here are some of the custom skins provided for the Bar-UI, and the shortcodes used:
  13. Hi Adrian, those changes didn't fix the error;
  14. ok thanks for helping out so fast, and hopefully this will help prevent this type of issue for forward versions!
  15. OK - thanks @adrian i will need to test this after 5pm (i think the owners are working in the admin so I don't want to crash the site during NY business hrs..)
  16. It's running 'version' => '4.0.4',
  17. Not completely sure what happened, but i upgraded Tracy on a site running 2.7.3 and it killed the site. I fixed the permissions on all of the Tracy files which were set incorrectly after upgrade, but this didn't prevent the issue. Error: Call to a member function queryString() on null (line 507 of ....wire/core/WireInput.php) This error message was shown because you are logged in as a Superuser. Error has been logged.
  18. Thanks, this is all working really well.
  19. This module is now available on GitHub. Still beta, but working well on all sites tested on. More documentation coming soon. If anyone out there needs inline audio on your site, check this out. ** make sure to read the instructions on Github, as those will always be updated to the latest (hard to keep the instructions here sync'd with the module instructions)...
  20. not sure if this could be handled by the module, and haven't researched yet about this... but i wonder about the possibility of hide and unpublish buttons on a page table, because it is something that would save my users a lot of time; example would be we have homepage sections which are handled by a page table. there can be many sections to the page table, but sometimes a user might want to hide one and unhide another one; in the current functionality of PT afaik you need to open the item, go to the settings page and check the buttons... TIA for reading!
  21. What is the $c - is that your pageArray? also, this is not much to go in, can you explain more?
  22. Hi Joss, nice site, and great music, For the audio players, you should consider trying the new Soundmanager2 module which will be released pretty soon...
  23. Soundmanager2 Audio for Processwire Github: https://github.com/outflux3/TextformatterSoundmanager Modules Directory: http://modules.processwire.com/modules/textformatter-soundmanager/ This module provides most of the free audio player interfaces for Soundmanager2 by Scott Schiller: Bar UI 360 UI 360+ spectrum UI mp3 buttons mp3 links Page Player, muxtape-style UI Cassette Player The module is a Textformatter that works by allowing you to insert shortcodes which are parsed into audio players. The players may be placed anywhere in the content (ck editor or other text field) using the shortcode, for example: [smplayer tag=audio1] The output will be a default single player (as specificed in the module settings), or if multiple audio files have the same tag, and you don't specify a type (UI), it will default to the Bar UI for the playlist. You may also specify page-player for the type as it also supports playlists. Here is a more complex tag: [smplayer tag=audio1 type=bar-ui color=2288CC] the tags available on shortcodes are: tag - *required to find the audio file on the page type (the type of player) limit (limit the number of files to load when using a playlist) Player specific tags for Bar UI: bar-ui (options for the bar-ui player) skin (applies to a bar-ui skin to load) extra (when set to true, it will display the extra controls) color (hex value for color - applies to bar-ui and mp3 buttons) compact (makes the player very narrow) playlist-open (make the playlist drawer open instead of needing to click the playlist button to open it.) dark-text (instead of white) flat (remove the faux 3d effect) When using the shortcode, you can chain the tags using underscore, for exmaple: [smplayer type=bar-ui bar-ui=flat_playlist-open_dark_text] Player specific tags for Cassette: cassette (options for the cassette player) In case you are not familiar with SM2, it powers a lot of major audio on the web, like Soundcloud, LastFM, AllMusic etc). The players are all rock solid and work on a wide range of browsers and devices. Features Multiple Audio Formats SM2 supports many formats, and those can be enabled/disabled in the module config if you want to prevent any from being loaded. So far this module was tested with MP3 and AAC (.m4a). GetID3 Support When enabled, ID3 tags from every audio file that pass through the Textformatter are read and cached as arrays using WireCache. Therefore the first load of a page with new audio files may be slow while the tags are read and stored. The tags are indexed by the filename of the audio, so as long as you don't upload multiple files with the same filename, or change the tags, the system will store the metadata permanently. To remove any metadata, you would need to use Soma's Cache Admin module, or clear it from the database. Schema Support When enabled, some schema tags relating to audio files will be added to the markup. CK editor Plugin Very basic dropdown that inserts some pre-configured player codes into the editor. Copy the plugin into your CK editor plugins folder, enable and add a button for 'soundmanager'. Instructions Before you install: 1) You will need a files field that accepts audio files, so set the extensions you want to use, such as mp3, m4a, mp4, wav etc. 2) Also make sure that you enable tags on the files field because the module references the tags for any audio file in the shortcode. 3) Add the files field to your template. Installation and Setup 1) Install the module and adjust your settings from the module configuration screen. 2) Add the TextformatterSoundmanager textformatter to the field where you want to insert audio (e.g. 'body'). 3) Optionally install the CK editor plugin to enable quick access to preconfigured shortcodes. 4) Add a shortcode into the textarea field that has the textformatter applied to. 5) You must reference the tag you entered in the audio file's tag field in the shortcode, and that will create a player for that audio file. 5a) To create a playlist, put the same tag in multiple audio files. Output 1) In order for the module to output the necessary styles and scripts, you need to echo the $config->styles and $config->scripts arrays into your site's header/footer. Here is an example: // In Header foreach($config->styles as $style) echo "<link rel='stylesheet' type='text/css' href='{$style}' />\n"; // In Footer foreach($config->scripts as $script) echo "<script type='text/javascript' src='{$script}'></script>\n"; API Usage To access the module's player method directly, you would first init the module in your _init.php file: $sm2 = $modules->get('TextformatterSoundmanager'); then anywhere in your templates, you can output any audio file with any player, in an configuration like this: $options = [ 'type' => 'bar-ui', 'skin' => 'gradient-fat', //'tag' => 'audio1', // tag is not needed when using the API //'bar-ui' => 'playlist-open' //all of the classes to apply to the bar ui. ]; foreach($page->audio as $track) { $content .= $sm2->player($track, $options); } Advanced Features Using other pages for storing music as playlists. You can create a field to hold a tag for a **page* and then refer to that tag in your shortcode. The shortcode word would be smplaylist instead of smplayer. The module will search the site for pages with that tag in that field. Then it will output all of the audio files in that page's audio field using the player and settings you specify. See the module configuration to select the tag field and adjust your shortcode words. Caveats Some player will not work well on the same page as other players. Bar UI and Page Player 360 Player and 360 Visual (large) players Also note that the cassette player can only occur once on a page. You can have multiple cassettes output, but they will all play the same audio file. The file that the cassette player uses is set in the script tag. In the future the setup may be modified to allow for cassette players to have their own audio files. About Soundmanager2 http://www.schillmania.com/projects/soundmanager2/ Speak and be heard More sound, in more places Despite being one of the senses, sound has largely been missing from the web due to inconsistent technology support. SoundManager 2 bridges this gap, making it easier to use audio across a growing variety of devices and platforms, both desktop and mobile. HTML5 + flash hybrid Complexity, reduced Supporting HTML5 audio can be tedious in modern browsers, let alone legacy ones. With real-world visitors using browsers ranging from mobile Safari to IE 6 across a wide range of devices, there can be many support cases to consider. SoundManager 2 gives you a single, powerful API that supports both new and old, using HTML5 audio where supported and optional Flash-based fallback where needed. Ideally when using SoundManager 2, audio "just works." The ginsu knife: 12 KB Big features, small footprint Performance is an important metric, too. SoundManager 2 packs a comprehensive, feature-rich API into as little as 12 KB over the wire when optimized; that's less than 8% of the original, uncompressed file size. SM2 is self-contained, having no external dependencies, and is compatible with popular JavaScript frameworks. The source code is BSD-licensed and is provided in fully-commented, non-debug and compiler-optimized "minified" versions appropriate for development and production use.
×
×
  • Create New...