Web Design & Development Blog

This blog covers a lot of technical web development issues, focusing especially on Joomla, Drupal, and other open-source CMSes & platforms. Not all our posts are for web developers; we also make sure to write posts for those who are not technical.

05 December 2012 Generating PDFs and PNGs on Ubuntu

category:
Web Design and Development

Ever needed to generate nicely formatted PDFs and/or PNGs on-the-fly? Check out wkhtmltopdf for PDF conversion using Webkit printing to PDF. From there you can conver the PDF to a PNG using pdftoppm.

Here's a very condensed run-down of the procedure on Ubuntu;

TCPDF is another widely used PDF conversion utility but I have found its layout and formatting options to be incredibly tedious. It makes a lot more sense to me to just print to PDF and let the Webkit browser do the heavy lifting .. with a helping hand from xvfb. You can invoke the xvfb command in PHP as follows:

<?php
$url = 'http://www.your-awesome-site.com/somepage.html;
$path = '/home/youraccount/somedir'; //path to where you want to write the file. Make sure the web user (www-data) owns this folder and has write permissions.
$pdfcommand = 'xvfb-run --server-args="-screen 0, 960x768x24" wkhtmltopdf '.escapeshellarg($url).' '.escapeshellarg($path).'some-awesome-file.pdf';
exec($pdfcommand);
//Then to convert the file to PNG:
$pngcommand = 'convert -density 300 '.escapeshellarg($path).'reminder.pdf '.escapeshellarg($path).'some-awesome-file.png';//imagemagick seems faster. 'convert' is the Imagemagick command. 
exec($pngcommand);
?>

   

21 August 2012 At DrupalCon Keynote in Munich!

category:
Drupal

We write to you today from DrupalCon Munich 2012. Dries Buytaert, Drupal's founder, talked about the plans for the future. Drupal 8 is scheduled for release mid 2013 (August-ish) with a feeature freeze this December and a code freeze in February 2013. He also talked a bit about how he views Acquia vs Drupal. Acquia is his company, which obviously benefits from Drupal, but it also benefits Drupal. He sees a fear of competition in the Drupal community, which he finds unfounded since there is a lack of Drupal developers when it comes to the growing market for Drupal sites. It is not unheard of for Drupal projects to get halted or switched to some other framework due to lack of enough developers. We need more competition, not less!

   

22 July 2012 SFTP write access when files owned by www-data

category:
Web Design and Development

Ubuntu users will recognize this common issue;

You have a user directory, e.g. /home/someuser, and you can SSH in and use 'sudo -s' to do super-usery things. Now try to SFTP (Dreamweaver, FileZilla, etc), and you can download, but if the files are 'owned' by www-data you probably can't upload anything except maybe new files. Many web applications (Drupal at least) need the files to be writable by the same user/group that Apache uses /... in the case of Ubuntu this is www-data.

You can't use 'sudo -s' within Dreamweaver or FileZilla.. yes, FileZilla has a custom command option, but it doesn't work with 'sudo -s'. 

You can "chown someuser:someuser * -R" inside the /home/someuser directory and make them writable by your user that way, but then you would need to chown them back to www-data to keep Drupal running well. 

A long-term solution is this:

sudo usermod -a -G www-data someuser

Then ... log that user out of the FTP client and try again. You have to log out for the new permissions to be recognized. 

   

09 June 2012 Geo-targeted blocks based on visitor IP (Drupal 7)

category:
Drupal

Ever needed to show one set of ads to visitors in one region and another set to those in another region? 
Here's how, using Drupal 7 and the ip2country module. 
2. Create or edit a block that you wish to restrict. 
 
Here is some sample code that goes in the block's "Show block on specific pages" area. The country codes are two-letter, all-caps codes. Capitlization IS important. 

Middle East / North Africa

<?php
$detectedcountry = module_invoke('ip2country','get_country',$_SERVER['REMOTE_ADDR']);
$mideast = array(
'AM','AZ','BH','GE','IR','IQ','IL','JO','KW','LB','NT','OM','QA','SA','SY','TR','TM','AE','YE','SO','DZ','MA','TN','EG','LY','CY'
);
if(in_array($detectedcountry,$mideast)){
return true;
} 
 
?>
 
US/Canada:


<?php
$detectedcountry = module_invoke('ip2country','get_country',$_SERVER['REMOTE_ADDR']);
$uscanada = array(
'US','CA','GU','FM','AS','VI','PR'
);
if(in_array($detectedcountry,$uscanada)){
return true;
} 

   

07 June 2012 Image slideshows with Drupal 7

category:
Drupal

We are frequently tasked with creating custom image slideshows for Drupal sites.

We work mainly in Drupal 7, and for simple home page sliders we like to use this combination;

  • New content type called Slide
  • Use Link Image Field and add that as a field in your Slide content type. Allow for unlimited images. This will allow you to link your slides to custom URLs and add titles, rel attributes etc.
  • A View (using Views) showing all results for nodes of type "Slide". Use fields display in combination with Nivo or Slideshow.
  • Try either Views Nivo Slider or Views Slideshow. We have had more luck with Views Slideshow. 
  • If using Views Slideshow, also consider Views Slideshow Configurable Controls, which enables next/pause/previous icons instead of just text links.
  • Create a new Slide node - let's call it "Home Slides". Add as many pictures as you need, and provide links for them as needed (thanks to Link Image Field). Save.
  • Edit your view and add a new display page or block. Add a filter for "nid" and restrict it to only the node ID of the "Home Slides" node you just created. Since we are including multiple images within a single node, we do not need to show multiple nodes. In the image field's settings make sure to NOT have it show multiple field results in a single row. We want them as separate rows so each photo will be separate. 
  • Add sorting as needed. Nodequeue isn't an option here, but you don't need it since you can drag and drop the images when editing the node. 
  • Your node is now essentially an image gallery exposed to Views. You could now also theme your Slide nodes to show thumbnail images in a gallery format, but you don't need to display the node. We only need it for Views.
   

07 June 2012 Headed to DrupalCon Munich!

category:
Drupal

There are some very interesting sessions lined up. Have a look: http://munich2012.drupal.org/

   

13 March 2012 Community Builder Phoca Gallery Plugin

category:
Joomla Developers

Check out our Community Builder plugin for the Phoca Gallery extension.

   

30 December 2011 Google Checkout is now Google Wallet

category:
Web Design and Development

Google Checkout has ... 'checked out' and change its name to Google Wallet. Google Wallet is essentially Google Checkout, but rebranded and targeted to mobile use as much as for use on regular sites (viewed from a personal computer). We look forward to working with wallet on some upcoming e-commerce projects.

   

30 December 2011 Keep your site from getting taken hostage

category:
Website Owners

All too frequently we hear from customers who have handed over the login details for their domain registrar (GoDaddy, NameCheap etc) only to have their web designer transfer the domain to another registrar that is outside the customer's control. The end result is of course that the customer then becomes dependent on that web designer and must beg and plead (and sometimes even pay fees reaching into the hundreds of dollars) just to get control of their own domain again. In a similar vein, many web design companies that also offer (or insist) on hosting your site for you will not provide hosting control panel access. This is a red flag, because it makes it impossible to save a backup of your site, again making you dependent on that web designer / webmaster. Please, at all times make sure you maintain control of your domain name(s)!

If you must provide someone with access to your domain name management area, make sure you have a clear idea of what it is they intend to do with that access. If you're using GoDaddy, you can assign someone as an AccountExec, so that they cannot change the account password on you. However, even with AccountExec access they'd be able to transfer the domain to another registrar if you're not careful.

It's your site: make sure you retain full control over it, even if you don't want to manage it on a daily basis!

   

23 December 2011 Joomla World Conference, San Jose - November 16-18 2012

category:
Website Owners

The Joomla! Project is pleased to announce that the first Joomla World Conference will occur in November 2012.  We are very happy that eBay has graciously offered significant support for this event, inviting us to use their facilities in San Jose, California.

Here are the preliminary details for the Joomla! World Conference:

Date: 16th-18th November 2012

Location:
eBay Town Hall
2161 North First Street
San Jose, CA 95131
USA

Tickets: Price for a 3-day Ticket is $199 USD

More details will follow next year.

http://www.joomla.org/announcements/general-news/5398-joomla-world-conference-2012.html

   

Page 1 of 5

request-a-quote

© 2003-2012 Plethora Design, LLC · Contact Us · Make a Payment · Search

877-51_Skype5-6682 / 703-291-8022. Northern Virginia web design company convenient to Washington, D.C. and Maryland.