Tag Archives: php

Drupal: FeedAPI Imagegrabber

Feeds Image Grabber (FIG) was released on 3rd March 2010, to support the Feeds module.

Introduction

FeedAPI Imagegrabber is a add-on module for FeedAPI. It consists of a parser which visits the original URL of a new feed item, and retrieves the main image from the post. Once the main image has been retrieved, it is then converted into a thumbnail using the ImageCache module, and stored in the node created by FeedAPI, inside a CCK field.

The purpose of FeedAPI Imagegrabber is to make the feed more informative as well as interesting for the user. As, we all know that “comics are much better than novels”, this module appends the feed-item with an appropriate image from its content URL. The goal of the module is to mimic the thumbnail display of websites such as digg.com. This goal is acheived by using FeedAPI to turn RSS feed-items into nodes, and then using FeedAPI Imagegrabber to append these nodes with an appropriate image from the feed-item’s webpage.
Continue reading

PHP: Archive files for Backup on Server

As Currently I am hosting this website on a free host, my web host imposes several limitations on me. One of them is not providing the feature to download the whole folder. This makes taking backup really hard as you have download each and every file yourself. Although it is a matter of days when I shift this website to a new server, I wrote the following PHP script which automatically archives the files in a folder and then the zip files can be easily downloaded with a single click. The script is crude in nature as I did not handle much exceptions but it works fine for me. You might need to change certain parameters to run it with your PHP resource limits. The code is pretty self explanatory although if you find difficulty understanding some part or find a bug or want to suggest any improvement, do leave a comment.
Continue reading

PHP: Relative URL to Absolute URL

Recently, I was working on a project and I needed to convert the relative URLs to their absolute URLs. An absolute URL such as “http://www.example.com/image.jpg” but mostly written as only “image.jpg” (relative URL) on the web pages. Web browser creates a complete URL using this relative URL and base URL. The base URL, must be absolute and it is often the URL of the web page containing the relative URL.

Now, if you need to access a file whose relative URL and base URL are known, you must combine them to create an absolute URL.
Continue reading