Codeigniter Image Manupulation Example

7th Oct 2011 at 9:31 AM | Posted in PHP | 49 Comments

Create a folder “uploaded” where your “application” folder is. (Not inside “application” folder”). Create a sub folder “thumbs” inside “uploaded”. Put a font in system/fonts/arial.ttf (copy the font from your windows).

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Imagetest extends CI_Controller {
	function __construct() {
		parent::__construct();
		$this->load->helper('url');
	}
	function index() {
		$path = realpath(APPPATH . '../uploaded');
		$file = "asd.jpg";

$path = str_replace('\\','/',$path);
		$config = array(
			'source_image' => $path.'/'.$file,
			'new_image' => $path.'/thumbs/'.$file,
			'maintain_ration' => true,
			'width' => 150,
			'height' => 100,
			'x_axis' => '100',
			'y_axis' => '40',
			'rotation_angle' => '180',
			'wm_text'		=> 'Test asdfsda sa dsa dsa dsa a',
			'wm_type'		=> 'text',
			'wm_font_path'		=> 'system/fonts/arial.ttf',
			'wm_font_size'		=> '30',
			'wm_font_color'		=> 'FF0000',
			'wm_vrt_alignment'		=> 'bottom',
			'wm_hor_alignment'		=> 'center',
			'wm_padding'		=> '10'

		);
		print "<pre>";
		print_r($config);
		$this->load->library('image_lib', $config);

		//$this->image_lib->crop();
		//$this->image_lib->clear();
		$this->image_lib->resize();
		/*$this->image_lib->rotate();
		$this->image_lib->clear();
		if(!$this->image_lib->watermark()) {
			echo $this->image_lib->display_errors();
		}	*/
		$this->load->view('imagetest');
	}
}
Advertisements

49 Comments »

RSS feed for comments on this post. TrackBack URI

  1. clemency…

    […]in the following are a couple of links to places which I link to because we believe they really are well worth visiting[…]…

  2. Related.. Trackback…

    […]the time to read or visit the content or sites we have linked to below the[…]…

  3. Hello Web Admin, I noticed that your On-Page SEO is not that great, for one you do not use all three H tags in your post, also I notice that you are not using bold or italics properly in your SEO optimization. On-Page SEO means more now than ever since the new Google update: Panda. No longer are backlinks and simply pinging or sending out a RSS feed the key to getting Google PageRank or Alexa Rankings, You now NEED On-Page SEO. So what is good On-Page SEO?First your keyword must appear in the title.Then it must appear in the URL.You have to optimize your keyword and make sure that it has a nice keyword density of 3-5% in your article with relevant LSI (Latent Semantic Indexing). Then you should spread all H1,H2,H3 tags in your article.Your Keyword should appear in your first paragraph and in the last sentence of the page. You should have relevant usage of Bold and italics of your keyword.There should be one internal link to a page on your blog and you should have one image with an alt tag that has your keyword….wait there’s even more Now what if i told you there was a simple WordPress plugin that does all the On-Page SEO, and automatically for you? That’s right AUTOMATICALLY, just watch this 4minute video for more information at. WordPress Seo Plugin

  4. Recommended Resources…

    […]the time to read or visit the content or sites we have linked to below the[…]…

  5. I never imagined how much stuff there was on this! Thanks for making this simple to
    figure out

  6. I am really impressed with your writing skills
    and also with the layout on your blog. Is this
    a paid theme or did you customize it yourself?
    Either way keep up the nice quality writing, it is rare to
    see a great blog like this one nowadays.

  7. First of all I would like to say fantastic blog!
    I had a quick question that I’d like to ask if you don’t mind.

    I was curious to find out how you center yourself and clear your mind before writing.

    I’ve had difficulty clearing my mind in getting my thoughts out. I truly do take pleasure in writing however it just seems like the first 10 to 15 minutes are lost simply just trying to figure out how to begin. Any ideas or hints? Appreciate it!

  8. I’m amazed, I must say. Seldom do I come across a blog that’s both educative and interesting, and let me tell you,
    you have hit the nail on the head. The issue is an issue that not enough people are speaking intelligently about.

    I’m very happy that I found this in my hunt for something concerning this.

  9. Wow, amazing blog structure! How long have you
    ever been blogging for? you made running a blog glance easy.
    The whole glance of your web site is magnificent, as well as the content!

  10. Hi to all, how is the whole thing, I think every one is getting more from this site, and your views are nice designed for new visitors.

  11. I knoա this if ߋff toƿic but I’m looking into starting my own weblog and
    was wondering what all is required to get set up? I’m assuming having a
    blog like yours would cost a pretty penny? I’m not very
    internet smart so I’m not 100% positive. Αny tips
    oг advice would be greatly appreciated. Kudos

  12. This is always a fact there is no lack in the amount of companies
    offering business process outsourcing Philippines services.
    The assess is enhanced employing the might of the portable handset indicator to assess
    how close to the cell place the portable invention is.
    Twitter is the best prime example, especially for companies like restaurants and bars.

  13. Quality articles is the crucial to attract the people to go to see
    the website, that’s what this website is providing.

  14. You really make it seem so easy with your presentation but I find this matter
    to be actually something that I think I would never
    understand. It seems too complex and very broad for me.
    I’m looking forward for your next post, I will try to get the hang of it!

  15. My partner and I absolutely love your blog and find many of your post’s to be what precisely
    I’m looking for. Do you offer guest writers to write content in your case?
    I wouldn’t mind producing a post or elaborating on a number of the subjects you write concerning here.
    Again, awesome weblog!

  16. It’s amazing for me to have a web page, which is valuable in favor of my knowledge.
    thanks admin

  17. Terrific work! That is the kind of info that are meant to be shared around the internet.

    Disgrace on the search engines for no longer positioning this publish
    higher! Come on over and consult with my site . Thanks =)

  18. Fantastic blog you have here but I was wondering
    if you knew of any user discussion forums that cover the same topics
    discussed in this article? I’d really like to be a part
    of group where I can get feed-back from other experienced people that share the same interest.

    If you have any recommendations, please let me know. Kudos!

  19. My spouse and I absolutely love your blog and find nearly all of your post’s to be precisely what I’m looking for.
    Would you offer guest writers to write content for yourself?
    I wouldn’t mind writing a post or elaborating on some of the subjects you write concerning here.
    Again, awesome web site!

  20. Yes! Finally someone writes about chairs.

  21. Greetings! Very helpful advice in this particular article!
    It is the little changes that make the biggest changes.
    Thanks a lot for sharing!

  22. I just like the valuable information you provide
    on your articles. I will bookmark your blog and take a look at once more right here regularly.
    I am moderately certain I’ll learn plenty of new stuff right right here!
    Good luck for the next!

  23. I’m not that much of a internet reader to be honest but your
    sites really nice, keep it up! I’ll go ahead and bookmark your site to
    come back in the future. All the best

  24. I’m cuгious to find out what blog system you are using?
    I’m having some small ѕecurity iѕsues with my latest websitе and I woսld like to fіnd something more safeguarded.
    Do you have any suggestions?

  25. Hmm is anyone else experiencing problems with
    the images on this blog loading? I’m trying to determine if its a problem on my end or if it’s the
    blog. Any responses would be greatly appreciated.

  26. Write more, thats all I have to say. Literally, it seems as though you
    relied on the video to make your point. You clearly know what youre talking
    about, why throw away your intelligence on just posting
    videos to your weblog when you could be giving us something enlightening to read?

  27. I think the admin of this site is really working hard in favor of his web site, since here
    every material is quality based information.

  28. TҺey normally get ߋn the net and jump at the first
    article of costlу еquipment they identify that promises all of the amazing
    features, but whеn they ɡet it, they have no notion the
    wɑy to use it. ” These are listed alphabetically so they are easy to find. Here you have a list of all the instruments already included with the program, to which you can add loops, more instruments and so on.

  29. Hello! Would you mind if I share your blog with my myspace group?
    There’s a lot of people that I think would really enjoy
    your content. Please let me know. Cheers

  30. Hello! This is my first visit to your blog!

    We are a team of volunteers and starting a new initiative in a community in the same niche.
    Your blog provided us beneficial information to work on. You have done a extraordinary job!

  31. Hello! I could have sworn I’ve been to this site before but
    after browsing through some of the post I realized it’s new to me.
    Nonetheless, I’m definitely happy I found it and I’ll be book-marking and checking back often!

  32. Ρlease let me know if you’re looking for a aгticle writer for
    your blog. You have some really good posts and I feel I would be a good asset.
    If you ever want to take some of the loaԁ off, I’d
    гeɑlly like to wгite some articles fօr your blog in exchange fօr a
    link back to mіne. Please shoot me an email if interested.

    Thank you!

  33. You have numеrous alternatives in relatіon to setting up ƴour aquarium.
    When he sees bugs, he stops and has snapped at
    them on occasion. ӏn the shades is the best option, the habitat can not be warmer than 35 degrees
    in the shade.

  34. After you fixed the problems with your website, submit Reconsideration Request to Google so your website will be re-evaluated.
    Frequent updates are perhaps the foundation of search motor optimization. On authors are just inventing something which sounded great.

  35. Hi there! Someone in my Facebook group shared
    this site with us so I came to look it over. I’m definitely loving the information. I’m bookmarking and will be tweeting this to my followers!
    Superb blog and superb style and design.

  36. Right here is the right blog for anybody who wants to find
    out about this topic. You know so much its almost hard to argue with you (not that I personally would want toHaHa).
    You certainly put a new spin on a subject that’s been discussed for many years.
    Great stuff, just wonderful!

  37. It’s wonderful that you are getting thoughts from this paragraph as well as from our discussion made here.

  38. Ӏt’s a shame you don’t have a donatе button! I’d most ceгtainly donate to this excellent blog!
    I guess for now і’ll settle for book-marking and adding your
    ɌSS feed to my Gߋogle account. I loоk forward to fresh updаtes and
    will talk about thіs site with my Facebook group.

    Talk soon!

  39. This post is truly a nice one it helps new web visitors, who are wishing in favor of blogging.

  40. My relatives always say that I am wasting my time here at net, however I know
    I am getting knowledge daily by reading such good content.

  41. Way cool! Some very valid points! I appreciate you writing this write-up and
    also the rest of the website is extremely good.

  42. wonderful issues altogether, you just won a new reader.
    What may you recommend in regards to your put up that you made some days ago?
    Any positive?

  43. Whoa! This blog looks just like my old one!

    It’s on a totally different topic but it has pretty much the same page layout and design. Superb choice of colors!

  44. Don’t hesitate to find a good lawyer because you feel that the situation is not that serious.
    Depending on how long you have been employed, the penalty amount can be substantial.

    The safety of other people is in your lap, so
    make the right choice.

  45. Hello fantastic website! Does running a blog similar to this require a massive
    amount work? I’ve very little understanding of
    computer programming but I had been hoping to start my own blog in the near future.
    Anyways, should you have any recommendations or techniques for new blog owners please share.
    I know this is off topic nevertheless I simply needed to ask.
    Thank you!

  46. Carmen Cortez is a specialist advisor of every type
    of business loan and currently working as financial consultant in Bad Credit Loans Information. These genuine occults always bring you right guidance to your right answers and
    right circumstances. All major manufacturer and retail online websites typically
    will offer a secure sign for your credit card purchases.

  47. Remarkable! Its genuinely awesome post, I have got much clear idea concerning from this article.

  48. I really like what you guys are up too. This sort of
    clever work and exposure! Keep up the very good works guys I’ve you guys to our blogroll.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Create a free website or blog at WordPress.com.
Entries and comments feeds.

%d bloggers like this: