IT Community - Software Programming, Web Development and Technical Support

Image handling in php

This is a discussion on Image handling in php within the PHP Programming forums, part of the Web Development category; Hi Anand, -density Defines the quality of the images that is pixels per inch -pointsize Defines the size of the ...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Web Development > PHP Programming

Register FAQ Members List Calendar Mark Forums Read
  #61 (permalink)  
Old 10-05-2007, 12:47 AM
Senthilkumar Senthilkumar is offline
D-Web Programmer
 
Join Date: Mar 2007
Posts: 93
Senthilkumar is on a distinguished road
Default Re: Image handling in php

Hi Anand,

-density
Defines the quality of the images that is pixels per inch
-pointsize
Defines the size of the text
-gravity
Defines the position of the text
south -> bottom center
southeast -> bottom left
southwest -> bottom right
center -> center
north -> top center
northeast -> topleft
northwest -> topright
-annotate
Defines the x and y position of the text
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #62 (permalink)  
Old 10-05-2007, 03:44 AM
Anand Anand is offline
D-Web Programmer
 
Join Date: Mar 2007
Posts: 52
Anand is on a distinguished road
Default Re: Image handling in php

Thanks for your reply,

The example you gave is for the commandline tool of imagemagick. But i am using frontend tool. It seems there is no such option in the frontend tool for this functionality. If there is any option please suggest me on achieving this.

Thanks,
__________________
None of us is As Strong as All of us.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #63 (permalink)  
Old 10-06-2007, 04:19 AM
Senthilkumar Senthilkumar is offline
D-Web Programmer
 
Join Date: Mar 2007
Posts: 93
Senthilkumar is on a distinguished road
Default Re: Image handling in php

Hi,

We used only the command line tools for the imagemagick. We haven't experimented with the front end imagemagick functions Let me digg deep into this topic and find out with a solution.

I hope there will be some way to solve this
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #64 (permalink)  
Old 10-06-2007, 04:31 AM
Anand Anand is offline
D-Web Programmer
 
Join Date: Mar 2007
Posts: 52
Anand is on a distinguished road
Default Re: Image handling in php

Hi,

It seems there is no built in function in image magick front end tool to align the texts.
[magick-users] Text alignment

When googling i found this link. Also, it seems we have to position the texts manually by the calculations.
__________________
None of us is As Strong as All of us.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #65 (permalink)  
Old 10-14-2007, 10:30 PM
venkat_charya venkat_charya is offline
D-Web Sr.Programmer
 
Join Date: Mar 2007
Posts: 118
venkat_charya is on a distinguished road
Thumbs up Re: Image handling in php

Hi Anand,

As far as text alignment concern in Magick there is one functionality available to do that.

That function is called setGravity(). In command line it is working with Magick 6.3 and greater but for front end it is under development and it is not completed yet. I hope the next version of magick release we will get this function soon.

But for your current use you can try this line of code. May be it help you somewhat.

convert SourceImage.jpg -font verdana.ttf -fill #993366 -pointsize 30 -gravity southwest -annotate +0+5 "Testing Gravity" DestinationImage.jpg

These are the main parameter value for gravity.
south
southwest
southeast
north
northwest
northeast

I hope as above parameter if we change and try we will able to set the alignment anywhere in image.

Thanks
__________________
K K Venkata Charya
Success is easy to get but difficult to retain
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #66 (permalink)  
Old 10-27-2007, 09:53 PM
venkat_charya venkat_charya is offline
D-Web Sr.Programmer
 
Join Date: Mar 2007
Posts: 118
venkat_charya is on a distinguished road
Thumbs up Re: Image handling in php

hi,

As like we discussed about Image Magick functionality there is another image functions available called "ImLib". This the latest and most useful one. The real good thing is it is much faster than anyother image library function while we compare this with GD, Magick or Wand.

Clarity of the image is also remain same like original one but while compare this with magick, magick contain the same DPI as like the oroginal image while ImLib create the image with 96 DPI.

There is lost of image function available in ImLib similar like other image function. Here i introduce the first and start of the any image functionality.

int imlib_load_image(string img[, int &err])
Load a file into an image, optionally fetch an error parameter


Thanks
__________________
K K Venkata Charya
Success is easy to get but difficult to retain
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #67 (permalink)  
Old 10-30-2007, 06:14 AM
Senthilkumar Senthilkumar is offline
D-Web Programmer
 
Join Date: Mar 2007
Posts: 93
Senthilkumar is on a distinguished road
Default Re: Image handling in php

Hi KK

can you explain in detail is any function available to convert one format(.jpg) of the image to another format(.gif)?
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #68 (permalink)  
Old 10-30-2007, 06:59 AM
venkat_charya venkat_charya is offline
D-Web Sr.Programmer
 
Join Date: Mar 2007
Posts: 118
venkat_charya is on a distinguished road
Thumbs up Re: Image handling in php

Hi Senthil,

To covert any image format as Jpg to Gif in ImLib you can use this function called imlib_image_set_format.

void imlib_image_set_format(int img, string format)
Sets the image format of an image.


Mention image and the desired format in parameter and you can able to create image with desired format.

Thanks
__________________
K K Venkata Charya
Success is easy to get but difficult to retain
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #69 (permalink)  
Old 10-31-2007, 05:33 AM
Senthilkumar Senthilkumar is offline
D-Web Programmer
 
Join Date: Mar 2007
Posts: 93
Senthilkumar is on a distinguished road
Default Re: Image handling in php

Hi KK

I need to covert a set of images(more than one image) to a pdf or zip format. Is any function available in imlib to convert morethan one image to a pdf or zip file format?

if available can you provide a sample code?
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #70 (permalink)  
Old 11-01-2007, 12:42 AM
venkat_charya venkat_charya is offline
D-Web Sr.Programmer
 
Join Date: Mar 2007
Posts: 118
venkat_charya is on a distinguished road
Thumbs up Re: Image handling in php

Hi Senthil,

As far as format concern we can change JPG as PDF with same function as i mentioned in my previous thread "imlib_image_set_format" but so far my knowledge we do not have any function like push list in ImLib which is available in Imagick.

In Imagick we can do this and those information available in same thread but we do not have pushlist option in ImLib.

Thanks
__________________
K K Venkata Charya
Success is easy to get but difficult to retain
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #71 (permalink)  
Old 11-02-2007, 07:46 AM
Senthilkumar Senthilkumar is offline
D-Web Programmer
 
Join Date: Mar 2007
Posts: 93
Senthilkumar is on a distinguished road
Question Re: Image handling in php

Hi,

Can anybody help me to find out DPI of image PDF. I create some set of images and pushed those in PDF but i can not able to find out the exact DPI of those images.

Can anybody tell me how can i find that?
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #72 (permalink)  
Old 11-02-2007, 07:56 AM
varghese varghese is offline
D-Web Programmer
 
Join Date: Feb 2007
Posts: 93
varghese is on a distinguished road
Thumbs up Re: Image handling in php

Senthil,

In your created PDF if you want to check the DPI of the images then you just have to right click that PDF and open with Photoshop. It will open all the images in photoshop thumbnail and you can choose any of those image and can able to check the height, width and resolution of the image.

I hope it help you.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #73 (permalink)  
Old 11-02-2007, 08:02 AM
Senthilkumar Senthilkumar is offline
D-Web Programmer
 
Join Date: Mar 2007
Posts: 93
Senthilkumar is on a distinguished road
Thumbs up Re: Image handling in php

Hi Varghese,

Thanks for your quick response. Yes while i open in Photoshop it shows as you said but the problem is while i open in Photoshop it asking me about rasterizing with default height, width and resolution. If i made changes there it is changed.

I don't think it provide accurate result.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #74 (permalink)  
Old 11-02-2007, 08:29 AM
venkat_charya venkat_charya is offline
D-Web Sr.Programmer
 
Join Date: Mar 2007
Posts: 118
venkat_charya is on a distinguished road
Thumbs up Re: Image handling in php

Hi Senthil,

Your are right. While we open that PDF file in Photoshop it ask that raster option which may change image value and we can not able to get the correct result.

To solve this problem you have to follow some step.

1. Install PDF Professional version because as per my checking i didn't get saveas option to change any PDF as JPG but it is available in PDF professional.
2. After that install Irfanview image viewer.
3. Save your pdf as JPG in any of your specific folder. It will create JPG of all images which available in your PDF.
4. Open those image in Irfanview.
5. Click "Image information" tool option which available in your toolbar just after zoom in option.

It will display complete image information accurately and you can able to find out the exact DPI of the image

Thanks
__________________
K K Venkata Charya
Success is easy to get but difficult to retain
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #75 (permalink)  
Old 11-11-2007, 09:15 PM
venkat_charya venkat_charya is offline
D-Web Sr.Programmer
 
Join Date: Mar 2007
Posts: 118
venkat_charya is on a distinguished road
Thumbs up Re: Image handling in php

Hi,

We are lot talking about Magick library in this thread but the first and formost used Image Library is GD library. This is first and most useful PHP Image library which used almost everywhere in Image Processing actions.

The imagecreate () function is used in PHP to create a new palette based image using the GD Library. It's two parameters are width and then height of the image to be created.

imagecreate ( int x_size, int y_size )

PHP Code:
<?php
header
("Content-type: image/png");
$im = @imagecreate(10050)
    or die(
"Cannot Initialize new GD image stream");
imagepng($im);
imagedestroy($im);
?>
Thanks
__________________
K K Venkata Charya
Success is easy to get but difficult to retain
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #76 (permalink)  
Old 11-12-2007, 09:58 PM
venkat_charya venkat_charya is offline
D-Web Sr.Programmer
 
Join Date: Mar 2007
Posts: 118
venkat_charya is on a distinguished road
Thumbs up Re: Image handling in php

HI,

Here i am discussing about GD Image Function called getimagesize (). This functions is used to get Image Height and Width.

getimagesize( string $filename [, array &$imageinfo] )

$vfilename = Image Path to calculate Image Size.

This function returns an array with 4 elements.
Index 0 contains the width of the image in pixels.
Index 1 contains the height.
Index 2 is a flag indicating the type of the image: 1 = GIF, 2 = JPG, 3 = PNG, 4 = SWF, 5 = PSD, 6 = BMP, 7 = TIFF(intel byte order), 8 = TIFF(motorola byte order), 9 = JPC, 10 = JP2, 11 = JPX, 12 = JB2, 13 = SWC, 14 = IFF, 15 = WBMP, 16 = XBM. These values correspond to the IMAGETYPE constants that were added in PHP 4.3.0.
Index 3 is a text string with the correct height="yyy" width="xxx" string that can be used directly in an IMG tag.

PHP Code:
<?php
$vImagePath 
"test.jpg";
$aImgSizeArr getimagesize($vImagePath);
echo 
"Image Width  =".$aImgSizeArr[0]."<br>";
echo 
"Image Height =".$aImgSizeArr[1]."<br>";
echo 
"Image Type   =".$aImgSizeArr[2];
?>
Ouput
Image Width = 400
Image Height = 500
Image Type = JPEG


Thanks
__________________
K K Venkata Charya
Success is easy to get but difficult to retain
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

LinkBacks (?)
LinkBack to this Thread: http://www.discussweb.com/php-programming/3146-image-handling-php.html
Posted By For Type Date
Anandkv's bookmarks on del.icio.us This thread Refback 08-21-2007 06:32 AM
DiscussWeb IT Community - Fusing This thread Refback 08-06-2007 03:07 AM

Similar Threads
Thread Thread Starter Forum Replies Last Post
Convert image to other image format using CODEC in .NET 3.0 Mramesh C# Programming 0 02-07-2008 03:33 AM
How to create an image from panel background Image S.Vinothkumar C# Programming 1 10-22-2007 03:52 AM
Error Handling in PHP sivaramakrishnan PHP Programming 13 09-21-2007 05:03 AM
How can I do error handling in php? itbarota PHP Programming 0 09-12-2007 12:39 AM
Image Handling in PERL raj Perl 4 08-23-2007 12:23 AM


All times are GMT -7. The time now is 03:18 AM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0