FlickrStickr module ported to use Curl

The FlickrStickr module for Drupal adds the handy Flock-like Flickr Photo Browser, making it easy peasy to add photos from Flickr to content in Drupal. But, the module uses the PHP fopen() command, which is disabled on Dreamhost's servers for security reasons.

So, with some really quick hackery (more like copy-and-pastery, following this example) I ported the module to use curl instead, and it works great. It doesn't seem to be able to insert images into the TinyMCE editor, so you have to toggle back to text mode to insert an image (oh, the irony!)

Basically, the "port" involved changing this:

   $fp= fopen("", "r");
   while (!feof($fp)) {
      $buffer= fgets($fp, 4096);
      echo $buffer;

to this:

   $curler = curl_init();
   $urlToCurl = "");
   curl_setopt($curler, CURLOPT_URL, $urlToCurl);

There were 2 locations that needed changing. Just search for "fopen" and you'll find them. Use the same pattern of changes for both, and test before deploying.

See Also

comments powered by Disqus