This repository has been archived on 2025-01-19. You can view files and clone it, but cannot push or open issues or pull requests.
oliverdavies.uk-old-sculpin/source/_posts/2010-04-28-imagecrop.md

33 lines
1.6 KiB
Markdown
Raw Normal View History

2015-03-16 21:18:03 +00:00
---
title: Using ImageCache and ImageCrop for my Portfolio
slug: using-imagecache-and-imagecrop-my-portfolio
tags:
2015-06-14 02:27:41 +00:00
- drupal
- drupal-6
- cck
- imagecache
- imagecrop
- imagefield
2016-12-29 16:32:52 +00:00
use: [posts]
2017-07-10 06:05:12 +00:00
redirect:
- blog/using-imagecache-and-imagecrop-my-portfolio/
2015-03-16 21:18:03 +00:00
---
Whilst working on my own portfolio/testimonial website, I decided to have a portfolio page displaying the name of each site and a thumbnail image. For this Blog post, I'll be using a site called [Popcorn Strips](http://popcornstrips.com) which I built for a friend earlier this year as an example.
I created a content type called 'Project' with a CCK ImageField called 'Screenshot'. I created a project called [Popcorn Strips](http://popcornstrips.com), used the [ScreenGrab](https://addons.mozilla.org/addon/1146) add-on for Mozilla Firefox to take a screenshot of the website, and uploaded it to the project node.
I created a View to display the published projects, and an ImageCache
preset to create the thumbnail image by scaling and cropping the image
to a size of 200x100 pixels.
Although, this automatically focused the crop on the centre of the image, whereas I wanted to crop from the top and left of the image - showing the site's logo and header.
I installed the [ImageCrop](http://drupal.org/project/imagecrop) module, which add a jQuery crop function to the standard ImageCache presents. I removed the original Scale and Crop action and replaced it with a Scale action with a width of 200px.
I then added a new 'Javascript crop' action with the following settings:
* Width: 200px
* Height: 100px
* xoffset: Left
2015-06-14 02:27:41 +00:00
* yoffset: Top