How to resize an image from database or file using php
Tech-Today

How to resize an image from database or file using php


This implementation is done using php.

Usually we resize image that we read from a local file, then save it locally.
Flow:
1.) read from local image file and store in a php variable
2.) resize the image file using php functionalities
3.) save the image file locally

Now what if we want to read an image file stored in a database then save it locally in a disk.
Here we will use the class from this url:
http://net.tutsplus.com/tutorials/php/image-resizing-made-easy-with-php/

$resizeObj = new resize();

if(isFile($file)) { //load as file
$resizeObj -> setFileName($newFileName);
} else { //load as binary string, read from database
$resizeObj -> setBinaryString($content);
}

$resizeObj -> resizeImage($width, $height);
$resizeObj -> saveImage("resized-".$newFileName);




- Encode Image And Display In Html
To encode an image file(eg. png, jpg, gif) we will need the apache commons-codec library. To avoid it in a maven project: <dependency> <groupId>commons-codec</groupId> <artifactId>commons-codec</artifactId> <version>1.11</version>...

- How To Implement An Image Streamer For Primefaces Graphicimage Component
This page provide code samples for using primefaces graphic image component. In this case we are assuming that the byte data of an image is stored in an entity and that entity is access by its id. See the param id in #1. The param id is read by the streamer...

- How To Render A Chart Object In A View In Mvc3
I was working on a project that requires showing a graph, fortunately there's already a built in graph helper in mvc3: http://www.asp.net/web-pages/tutorials/data/7-displaying-data-in-a-chart. Tried the tutorial in link above and was able to display...

- Iphone Xcode - Create A Simple Uiscrollview
Finally getting acquainted with iPhone's xcode. Now I'll build a simple window base application to demo the UIScrollView features. 1.) Create a new window base application, named it MyScroll. It should create 2 files: a.) MyScrollAppDelegate.h...

- How To Remove The Extra Space Added By Ie Browser On Div Tags
I just want to put an image inside a div like this: <div> <div> <img src="image.jpg" alt="Image" /> </div> </div> Seems easy right? Unfortunately, it took me 15 minutes to figure out that the IE browsers are inserting an...



Tech-Today








.