Adding a new image style to Media WYSIWYG while using Display Suite

This is getting a bit convoluted, but I guess thats the price of power.

  1.  Create the image style.
  2. Create a corresponding view mode and allow it to be used with files
  3. Enable the view mode for the image field type.
  4. Go to the image file display and select the view mode from the tabs
  5. Check colorbox in enabled displays then choose the new image style in ‘Content Image Style’.

Now the view mode will be available for selection when you insert an image.

Setting up Varnish for Drupal on CentOS 6

Varnish has an offical repository so let’s add it to Yum as outlined on https://www.varnish-cache.org/installation/redhat

Set Varnish to start on system boot

Setup DAEMON_OPTS in /etc/sysconfig/varnish, something like below. It will be commented out by default:

Edit the default.vcl file. We use the following for Drupal, which Four Kitchens kindly made available.

Now update your web server to serve from port 8080, and restart the server and varnish.

Download and enable the drupal varnish module:

Add something like the following to settings.php:

Hopefully the site is now using Varnish, you can get some good stats using the varnishlog and varnishstat programs that are included with Varnish.

Setting up memcached with Drupal 7 on Centos 6

Firstly get access to RPMForge repositories. Next install memcached:

Check memcache stats:

Configure memcache:

Configuration details for memcache can be found here

Install the PECL memcached extension for PHP

Install the memcache drupal module and configure the website via settings.php

https://drupal.org/project/memcache

You don’t need to enable the module unless you want a stats UI.

Edit your site’s settings.php, adding something like the following:

Truncate the cache table, clear the cache and check that the cache table stays empty when you load some pages. Check the memcache stats and see that data is going into the cache.

Hopefully it’s working now!

References

Drupal Memcache module – https://drupal.org/node/1131468

Configuring Memcache from the memcache wiki – https://code.google.com/p/memcached/wiki/NewConfiguringServer

 

Regenerating Path Aliases Programatically in Drupal 7

It should look something like this:

Drupal 7 – Programatically update a media module file display image style

I needed to push a change to a file display’s image style through to production, and Features didn’t seem to want to take it so I needed to push it via an update hook.

Using code from file_entity_file_display_form_submit() and media_install() i came up with this, which worked:

Might be useful for someone in the future..