Jump to content

Pete

Administrators
  • Posts

    4,035
  • Joined

  • Last visited

  • Days Won

    66

Everything posted by Pete

  1. I'm seriously contemplating looking at this one for a project I'll start next month to be honest. It's one of those things - if you're not doing a very stylised design then it could save lots of time. Even if you are, just don't use the bits you don't need and customise the rest. I must say I'm always re-inventing the wheel with each website which wastes time - I've not got a set starting template or CSS which is a little silly.
  2. That would require some HTML and CSS knowledge as it's not just another off the shelf theme. For the CSS, you would want to look in site/templates/styles/main.css and for the template layout you would need to tweak site/templates/head.inc and foot.inc If you're not too comfortable with CSS and HTML then it would be worth looking through some template websites - either free ones or cheap ones like Themeforest and it wouldn't take too much to implement a new template.
  3. Ah yes, I remember that discussion about different ways of displaying templates/content now.
  4. I think he means head.inc - the code would certainly work there
  5. No problem Hani - I thought it would be quite a useful addition as you don't need to see the thumbnail options where you don't need them, plus it can reduce confusion for clients too if they apply a crop and the crop tool isn't used in a particular template.
  6. Passthroughs in PHP seem to be the standard for a lot of file download systems to be honest. I might be wrong, but with some cleverness you can also allow it to resume interrupted downloads this way which I'm not sure you can do with a direct link. This is the function that actually handles the download in the script I've used previously (it's getting on a bit now ). // Print the http header header("Cache-control: private\n"); // fix for IE to correctly download files header("Pragma: no-cache\n"); // fix for http/1.0 header("Content-Type: ".$filetype); if ( $myrow["realsize"] ) header("Content-Length: ".(string)($myrow["realsize"]) ); header("Content-Disposition: attachment; filename=".$filename); header("Content-Transfer-Encoding: binary"); // Open and display the file.. fpassthru( $fh ); @fclose( $fh ); exit(); } // there was some error message generation code at this point that's not relevant The above is using some variables from a database query (this system acatually masked the filenamess with some form of MD5 hashing so you can't tell what's what if you look at the files on the file system itself, and it pulls various bits from the database to pass the file to teh suer with the correct name and increment download counts etc. All of that is a bit over the top, so I've just copied in the relevant bit in case it's useful.
  7. Happy to help I'll do it tomorrow when I'm back at my computer (and can figure out GitHub again - I don't use it often enough to remember how it works ).
  8. You're probably expecting $config->urls->root to return a full URL (I'm guessing) in which case you need $pages->get('/')->httpUrl; See this thread for info:
  9. Hey Antti (and others) - I went ahead and made it so that the module can now accept comma-separated lists of templates per thumbnail config. For example, in the module config, enter a new crop setup called bigthumb like this: bigthumb,320,240,home,search The two extra parameters on the end are templates that this is applicable to. You can keep adding templates to the list to your hearts' content, and in this case it won't show you a thumbnail option for the images field on the basic-page template since you narrowed it to a specific list. If you want the thubmnail to be available to all templates, simply don't add any more parameters after the first three The code, oddly enough, is in the same function as my last post, so change that entire function in InputCropImage.module to the following: protected function renderItem($pagefile, $id, $n) { $out = parent::renderItem($pagefile, $id, $n); $crops = $this->modules->get('ProcessCropImage')->crops; if (strlen($crops)>3) { // If we've defined one or more templates for specific crops, we need to check the current page's template to see if we actually have any applicable crops to show to the user $page = $this->pages->get($this->input->get->id); $applicableCrops = array(); $cropArray = explode("\n", $crops); foreach ($cropArray as $k => $v) { $cropItems = explode(',', $v); if (count($cropItems) > 3) { if (in_array($page->template, array_slice($cropItems, 3))) { $applicableCrops[] = $cropArray[$k]; } } else { // Any non-template-specific crops are automatically added to the list for all cropimage fields $applicableCrops[] = $cropArray[$k]; } } $applicableCrops = implode("\n", $applicableCrops); if (!empty($applicableCrops)) { $cropLinks = $this->_getCropLinks($crops, $cropUrl, $pagefile); if (!empty($cropLinks)) { $cropUrl = "../image-crop/"; $cropStr = "\n\t\t\t<div class='ui-widget-content crops'><p class='description'>Thumbnails (hover to preview, click to crop)</p>". $this->_getCropLinks($applicableCrops, $cropUrl, $pagefile) . "</div>"; // We add our crop string at the end of the list item that holds image $out .= $cropStr; } } } return $out; } If no crops are applicable to a particular template, it simply doesn't render the thumbnails box below each image.
  10. Fixed it. This just needs tidying up and putting into the source, but if you open InputfieldCropImage module and find the relevant function below and replace it with the code below: protected function renderItem($pagefile, $id, $n) { $out = parent::renderItem($pagefile, $id, $n); $crops = $this->modules->get('ProcessCropImage')->crops; if (strlen($crops)>3) { $cropUrl = "../image-crop/"; $cropStr = "\n\t\t\t<div class='ui-widget-content crops'><p class='description'>Thumbnails (hover to preview, click to crop)</p>". $this->_getCropLinks($crops, $cropUrl, $pagefile) . "</div>"; } // We add our crop string at the end of the list item that holds image $out .= $cropStr;//str_ireplace('</li>', $cropStr, $out); return $out; }
  11. I've just encountered the same thing. It displays as a normal image field as you say and I get none of the crop links for my configured crops next to the images.
  12. For the pages, you would use something like $yourpagelist = wire('pages')->get(your-selector-here)... I thinkthe rest will more or less follow the same structure as above if you see what I mean?
  13. Just going back to the option of storing it outside of the web root, it doesn't look like it would be too hard to create a new fieldtype based on the InputfieldFile.module Obviously this doesn't help you in your current situation, but I'm thinking out loud so ryan could possibly comment on this ryan - it seems that there is a $this->destinationPath variable. Whilst you can't link directly to a document outside the document root, is it technically possible to extend the module and have it create a folder outside the root, then set this variable to point to it (and on a page-by-page basis have it create a subfolder with the document ID as the subfolder name?). If so, then with a little work it wouldn't be too hard to have the path configurable (I think). Since you can't automatically serve a file that's above the document root directly, there would need to be a function in the module that deals with this as well, but I think that if this sounds do-able to ryan then I might take a stab at it at some point in the future (next few weeks are pretty busy, but after that then maybe ).
  14. Well I think it would be a good module - I don't think that if you were putting multiple videos on one site that the dimensions would be different for each vid, so globally setting it would be fine. The only other thing I can think of is specifying either different dimensions for different templates or for different fields. Something like the config options in Antti's thumbnail module is what I'm thinking for that.
  15. There's a very good and elegant example in the default head.inc file that does exactly what you're after - well worth a look
  16. Just updated this to version 1.1.0 as it now supports the ability to upload an image with a post There's now an additional field called allowedPagePhotoParents that lets you pick page parents that you want to have the child pages upload an image along with a tweet. The original allowedPageParents field is still there, so you can specify sections where a new page will only create a text tweet, and if you select the same page in both lists, the photo field will take priority and it will try and upload a photo (seemed the easiest way to get around two conflicting values in the lists). If the page you save is in a section that is in the allowedPagePhotoParents list, it will check for an images field on that page and, if it finds the field and there is at least one image in it, it takes the first image and passes it along to Twitter along with the link to the page as well as your optional configurable tweetText prefix text. EDIT: Only slight thing is that this class comes with some sort of certificate file (part of advanced authentication I think) so the module package is a lot bigger. It shouldn't be a problem though as the module will only be run when a page is saved, and that certainly doesn't happen every second.
  17. I like that idea ryan, so basically any YouTube URL you type into the editor gets converted when the page is rendered
  18. Updated the module to fix some errors with variables. It would have worked fine before, but there was an unneccessary line as well as an unnamed variable.
  19. Of course I just realised you may already know that and the date/time field should probably know that too is probably what you mean
  20. The date you're experiencing is when unix time is counted from (you'd have to google it to find out why - I can't remember) so a value of zero means zero seconds since that date. Strange but true.
  21. With regards to this module, I'm looking to expand the included Twitter class to support sending photos as well (seems logical since Twitter now natively supports photos so they display inline in feeds). It's needed for a website I'm building so it makes sense. My only worry about that idea is that at present you can select multiple parent pages whose child content will be auto-tweeted. How could I go about optionally selecting which categories would send a photo to Twitter? The most likely option is that I'll have a config option to turn photo uploads on/off and have it just be a global setting, so if there's an images field in the template, it just takes the first picture and uploads it. I suppose another option would be to have two more config fields - one for "sections whose children upload the first image from the images field" and "sections whose children upload ALL images from the images field" and have them as ASMSelects based off the first ASMSelect (if that's possible). Or just a comma-separated list. The latter option of uploading all images would be good for news sections for any type of site, but in my mind I've got a gaming site with 3 exclusive photos accompanying a new article for example. That assumes Twitter will allow multiple images per tweet and what the limits are.
  22. Sorry, I think it's Markup Cache module and not Fieldtype - I forgot to specify which one (the Fieldtype cache module is on by default whereas ModuleCache isn't).
  23. Thanks ryan - you're right, I didn't have debug mode on whilst I was coding it so that's one to remember in future and I'll take a look at those variables at some point this week. As for the code, it was made reasonably easy with Tijs' classes, and I'll admit I know very little about "try catch" (I think those blocks of code were adapted from one of his examples) but I did have fun implementing that ASMSelect in the config (I was surprised how simple it was in the end actually once I worked it out). I'm actually getting pretty into the idea of turning third party classes into installable, configurable modules. I've got a few fun ideas I'd like to try out at some point involving automated weekly emails using something like PHPMailer or perhaps MailChimp - with good enough classes and good enough reasons to turn them into modules the options are pretty limitless, though obviously licensing issues come into play in some cases.
  24. Thanks, I'll bear that in mind. It was to do with the IPB Forum module I sent over to you so I found a good enough solution in the end by adding it to the $page object
  25. Could you try uninstalling both modules and then reinstalling the cache one first and see if that helps please?
×
×
  • Create New...