Tag: PHP

Drupal HTTPS images

Posted by on March 2, 2011 | No comments

I was involved with a project for a while which was using Drupal as the CMS. The entire site was being served over HTTPS, which was quite annoying as a large pile of the images that were being posted were being served over HTTP from their respective webservers. Naturally, this resulted in everyone getting very annoyed at their browser warning about loading unsecured content on a secure page.

So, I came up with this module. I’ve been meaning to release it for ages, but as I need to clear down the server it was running on it’s made me take the five minutes to write this post. Still needs a bit of work, but does what it says on the tin.

It identifies non-local images in content, downloads them and serves them from a local cache.

Download the module here: img_proxy.tar.gz

If you use Drupal, you should already know the drill – extract the file to your modules directory and enable it in the modules page. The module is implemented as an input filter, so you will then have to add it to the appropriate input formats at http://your.site.com/admin/settings/filters

Notes

  • Licenced under the GPL version 2.
  • *** There is nothing in the code that verifies the file being proxied is an image!! *** (that’ll be in the next version!)
  • May not work with sites that check the referer of the request for images.
  • I’ve been meaning to release this for ages, but there is sill a lot of debug code thats just commented out.

Hopefully I’m not the only webmaster that ever had this issue and somebody will find this handy.

Maybe one day I’ll tidy up the code and submit it to the Drupal Module repository!

Enjoy.

Tags: , , , , ,

WordPress Front Page Single Post

Posted by on September 11, 2009 | 6 comments

Well, I’ve rejigged my site theme, and I decided to play a bit with the layout.

The look of the site seemed to be better with just the excerpt from a single post on the front page.

Now, that sounds really straight forward and something that WordPress should be able to do out of the box. And it is.

However, if you want the “Older Entries” pages to then show, say, 10 posts you’re knackered as all subsequent pages will just show 1 entry. I tried the Custom Post Limits plugin, but it still didn’t work as page 2 started at post 6.

After reading a lot of entries on this topic (it seems I’m not the only person keen on this!) and getting nowhere fast. Lots of “read this link then work it out yourself” type replies I finally got something to work. Using both the offset AND paging attributes of the query_posts() function!

The only issue with this is that the last page wouldn’t show at all. This was due to the fact that the front page misses all but 1 of the entries, then the 2nd page starts at entry 2. In effect you’re missing a number of entries up to the usual number per page minus 1 – everything that would be on the last page. To get round this, I simply double the number of entries displayed on what WordPress believes is the final page.

» Read the full post

Tags: , , ,

Exchange Guid converter tool

Posted by on September 18, 2007 | 109 comments
ExchangePHPTech

In response to the amount of comments I’ve had (which are way way more than I was ever expecting!) on my Exchange Mailbox Recovery article, I’ve written a script to convert your guids from the bad format that exmerge gives you to the one thats required for updating the user account.

You can access it here. Please leave any feedback on this post.

Tags: , , ,

LastFM for Drupal

Posted by on August 23, 2007 | No comments
DrupalPHPTech

So, I’ve been playing with Drupal recently.

At first it did my head in, but then something sorta clicked. Not been near the Taxonomy module yet, but when I do I expect that process to reverse.

Anyway, I decided I needed a module that will allow users to show their LastFM stuff on their profile pages. I couldn’t find one so I wrote one.

I stared out with the Onlinestatus module as it did something very similar to what I was hoping to achieve.

Anyway, the module is attached should you feel so inclined. (Requires the profiles module I think. The one I based it on does anyway, so it probably does too.)

Download: lastfm.tar.gz

Tags: , , , ,

User VHosting

Posted by on August 30, 2006 | No comments

So, previously, I detailed how to do web virtual hosting to directories on the file system. This is all well and good, but I want to have users pidgeon holed into their own directories, plus I want users own websites to be stored under their own directories in a similar format to that used in the previous article (eg. /home/user/web/example.org/subdomain)

The problem lies with mapping domain names (example.org) onto user accounts (Alice? Bob?). This is where Apache and mod_rewrite come to the rescue again. On Wintermute I’ve installed Apache 2, but this recipe will work just as well with Apache 1.3. » Read the full post

Tags: , , , ,

Powered by Wordpress and Stripes Theme Entries (RSS) | Comments (RSS)