Edmonds Commerce Logo
  • home
    • blog
  • ecommerce
    • product catalogue
    • order processing
    • customer services
    • stock control
    • human resources
    • management information
  • development
    • oscommerce
    • php
    • mysql
    • open source
    • performance tuning
  • design
  • marketing
  • contact us
    • pricing

Edmonds Commerce Blog

Freelance PHP Ecommerce and SEO Developer in the UK

Latest Posts

CRELoaded Remove Google Ads -
ICECat Integration with osCommerce, Magento etc
Magento UK
PHP Cached Download Function

Most Popular Posts

PHP Email Attachment Function Freelance osCommerce UK Ultimate osCommerce Checkout - Fast and Friendly PHP : Dead Easy Excel Export

Who Needs Photoshop? PHP GD Images and Your Online Store

February 18th, 2008
Read More gd, php, programming

Many web masters will be familiar with Photoshop by Adobe. This highly featured photo editing and graphics application is incredibly powerful, but also incredibly expensive. If you find that the main thing you do with photoshop is basic product image cropping, resizing, trimming, rotating and watermarking then there is a better way!

If your server uses PHP and has GD functionality enabled, you can use the power of the GD library to automatically do all of these things for you. Furthermore the GD library is faster than using photoshop and as the process actually runs on your server, you do not have to worry about uploading files. Your employees can directly manipulate product photos from your web store administration screens.

Chances are the main thing you will need to do is to take one hi res source image and create one or more resized versions of it to be displayed as thumbnails or product info page images. Your Hi Res images can then be displayed as a pop up or lightbox.

There are many PHP GD thumbnail classes etc out there and you will easily find one by searching the major search engines.

Here are the basic concepts though:

1. Grab an image into memory from an external jpeg file
Before we can do anything we have to get an image into the memory. This then gives us something to work with.

PLAIN TEXT
PHP:
  1. //grab image into memory,  $img = full url to jpeg image
  2. if(!$jpeg = imagecreatefromjpeg($img)){
  3. echo '
  4. <h2 style="color: red">Failed to Grab Image ' . $img . '</h2>
  5. ';
  6. exit;
  7. }

2. Manipulate Image however you want
There are all kinds of things you can do with the image you have loaded using the GD library.

3. Display the Image or Save to Disk
Once you have manipulated the image and have it looking the way you want, you can either serve it up or save it to the disk. Of course you can also do both if you prefer.

PLAIN TEXT
PHP:
  1. //save image
  2. $save_path = 'Your Save Path';
  3. imagejpeg($jpeg,$save_path);
  4.  
  5. //display image
  6. header ("Content-Type: image/jpeg");
  7. imagejpeg($jpeg);
  8.  
  9. //destroy image to free memory
  10. imagedestroy($jpeg);

Related Resources
http://uk3.php.net/gd
http://www.phpclasses.org/browse/package/1365.html
http://www.phpit.net/article/image-manipulation-php-gd-part1/

Bookmark this Post
Add 'Who Needs Photoshop? PHP GD Images and Your Online Store' to Del.icio.usAdd 'Who Needs Photoshop? PHP GD Images and Your Online Store' to diggAdd 'Who Needs Photoshop? PHP GD Images and Your Online Store' to FURLAdd 'Who Needs Photoshop? PHP GD Images and Your Online Store' to blinklistAdd 'Who Needs Photoshop? PHP GD Images and Your Online Store' to redditAdd 'Who Needs Photoshop? PHP GD Images and Your Online Store' to Feed Me LinksAdd 'Who Needs Photoshop? PHP GD Images and Your Online Store' to TechnoratiAdd 'Who Needs Photoshop? PHP GD Images and Your Online Store' to Yahoo My WebAdd 'Who Needs Photoshop? PHP GD Images and Your Online Store' to NewsvineAdd 'Who Needs Photoshop? PHP GD Images and Your Online Store' to SocializerAdd 'Who Needs Photoshop? PHP GD Images and Your Online Store' to Ma.gnoliaAdd 'Who Needs Photoshop? PHP GD Images and Your Online Store' to Stumble UponAdd 'Who Needs Photoshop? PHP GD Images and Your Online Store' to Google BookmarksAdd 'Who Needs Photoshop? PHP GD Images and Your Online Store' to RawSugarAdd 'Who Needs Photoshop? PHP GD Images and Your Online Store' to SquidooAdd 'Who Needs Photoshop? PHP GD Images and Your Online Store' to SpurlAdd 'Who Needs Photoshop? PHP GD Images and Your Online Store' to BlinkBitsAdd 'Who Needs Photoshop? PHP GD Images and Your Online Store' to NetvouzAdd 'Who Needs Photoshop? PHP GD Images and Your Online Store' to RojoAdd 'Who Needs Photoshop? PHP GD Images and Your Online Store' to BlogmarksAdd 'Who Needs Photoshop? PHP GD Images and Your Online Store' to ShadowsAdd 'Who Needs Photoshop? PHP GD Images and Your Online Store' to Co.mments
Add 'Who Needs Photoshop? PHP GD Images and Your Online Store' to ScuttleAdd 'Who Needs Photoshop? PHP GD Images and Your Online Store' to BloglinesAdd 'Who Needs Photoshop? PHP GD Images and Your Online Store' to TailrankAdd 'Who Needs Photoshop? PHP GD Images and Your Online Store' to SegnaloAdd 'Who Needs Photoshop? PHP GD Images and Your Online Store' to OKnotizieAdd 'Who Needs Photoshop? PHP GD Images and Your Online Store' to NetscapeAdd 'Who Needs Photoshop? PHP GD Images and Your Online Store' to Bookmark.itAdd 'Who Needs Photoshop? PHP GD Images and Your Online Store' to AskAdd 'Who Needs Photoshop? PHP GD Images and Your Online Store' to SmarkingAdd 'Who Needs Photoshop? PHP GD Images and Your Online Store' to LinkagogoAdd 'Who Needs Photoshop? PHP GD Images and Your Online Store' to DeliriousAdd 'Who Needs Photoshop? PHP GD Images and Your Online Store' to SocialdustAdd 'Who Needs Photoshop? PHP GD Images and Your Online Store' to Live-MSNAdd 'Who Needs Photoshop? PHP GD Images and Your Online Store' to SlashDotAdd 'Who Needs Photoshop? PHP GD Images and Your Online Store' to SphinnAdd 'Who Needs Photoshop? PHP GD Images and Your Online Store' to DiggitaAdd 'Who Needs Photoshop? PHP GD Images and Your Online Store' to SeotribuAdd 'Who Needs Photoshop? PHP GD Images and Your Online Store' to FaceBookAdd 'Who Needs Photoshop? PHP GD Images and Your Online Store' to UpnewsAdd 'Who Needs Photoshop? PHP GD Images and Your Online Store' to WikioAdd 'Who Needs Photoshop? PHP GD Images and Your Online Store' to Social Bookmarking Reloaded

Feed | Respond | Trackback

Leave a Reply

  • RSS Feed
  • Categories

    • apache
    • barcode
    • creloaded
    • curl
    • customer services
    • debugging
    • ecommerce
    • email
    • excel
    • firefox
    • flash
    • gd
    • graphs
    • hosting
    • icecat
    • internet news
    • javascript
    • link building
    • linux
    • magento
    • management
    • mod_rewrite
    • mysql
    • oscommerce
    • php
    • plesk
    • product catalogue
    • product feed
    • programming
    • regular expressions
    • scraping
    • search engine optimisation
    • spidering
    • ubuntu
    • web design
    • web development
    • Windows
    • xampp
    • zip
  • Archives

    • August 2008
    • July 2008
    • June 2008
    • May 2008
    • April 2008
    • March 2008
    • February 2008
  • Tags

    addons advanced adverts blackhat blocking css curl development directories find firefox google hosts file html javascript keywords links msn mysql myths operators oscommerce paid links paid placement performance php ppc reciprocal linking replace screen scraping security seo serp speed spider spidering tuning user friendly vista web web design web developer
  • Random Posts

    • Who Needs Photoshop? PHP GD Images and Your Online Store
    • osCommerce Contribution Released: Server Migration Synchronisation
    • HOSTS file, Vista and Blocking Unwanted Adverts
    • PHP, cURL, CURLOPT FOLLOWLOCATION and open basedir Or Safe Mode
    • SEO, Links, Pagrank and Anchor Text
    • osCommerce Output Queries Debug : Store Speed Optimisation
    • Flash and PHP Charts and Graphs
    • Chemos SEO URLS for osCommerce
    • Saving a File or Webpage using PHP
    • Meta Title Tag and SEO

Edmonds Commerce related questions? Send us a message or call us on 0844 357 0201.

Freelance PHP Web Design UK Commercial Web Design