Jul 25, 2008

Using The Image Editing Functions Of Php - Specifically, lines or regular polygons.

Free Web Hosting, No Ads > CONTRIBUTE > Computers > Programming Languages > PHP Programming

free web hosting

Using The Image Editing Functions Of Php - Specifically, lines or regular polygons.

beeseven
I've been experimenting a little with PHP's image functions and I was trying to see if I could make something that looked 3D, so I started with a cube because it's simple. To make an isometric picture of a cube, you need to start with a regular hexagon. However, making a regular hexagon isn't the easiest thing. Is there a function to create a regular polygon, or specify an angle and magnitude for a vector?

Reply

beeseven
Done a little copying recently?

http://www.phpbuilder.com/columns/cash20030526.php3

Notice from snlildude87:
Copied post deleted

Reply

Mike
PHP has image editing functions?! >_>; I never even knew that. I mean, I knew it had tons of mail functions and all that good stuff but never image editing functions. The most recent thing that I have learned that have to do with shapes is something that you add in CSS. It's like this:

CODE


-moz-border-radius: #px;



I had no idea you could edit pictures with PHP...

Reply

mobious
with the GD module loaded as a PHP extension, PHP gains image-editing functions.

Reply

beeseven
Yeah, you can do stuff but it's pretty complicated. Here's an example:

http://www.tjhsst.edu/~tsmilack/tests/image.php

The code is:
CODE
<?php
header("Content-type: image/png");
$img = imagecreate(500,500);
$topleft = imagecolorallocate($img,255,0,0);
$bottomright = imagecolorallocate($img,255,255,0);
$topright = imagecolorallocate($img,0,0,255);
$bottomleft = imagecolorallocate($img,0,255,0);
$middle = imagecolorallocate($img,255,0,255);
$border = imagecolorallocate($img,0,0,0);
$diamond = imagecolorallocate($img,255,128,0);
imagefilledrectangle($img,0,0,250,250,$topleft);
imagefilledrectangle($img,250,0,500,250,$topright);
imagefilledrectangle($img,0,250,250,500,$bottomleft);
imagefilledrectangle($img,250,250,500,500,$bottomright);
imagefilledrectangle($img,125,125,375,375,$middle);
$points = array(125,250,250,125,375,250,250,375);
imagefilledpolygon($img,$points,4,$diamond);
imagerectangle($img,0,0,499,499,$border);
imagepng($img);
imagedestroy($img);
?>

 

 

 


Reply



Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

(Maximum characters: 10,000)
You have characters left.
Confirm Code:

Similar Topics

Keywords : image editing functions php specifically lines regular polygons

  1. Functions - ??? (7)
  2. Watermark Your Image With Simple Php Script - found it on the net (34)
    This script was found on the net http://tips-scripts.com/?tip=watermark#tip B&T's Tips &
    Scripts site. Just in case the site may not show, I will include the code here: List of things
    needed: 1. your image in any format 2. watermark image--in gif format with transparent background 3.
    script below with name (i.e. watermark.php) CODE <?php // this script creates a watermarked
    image from an image file - can be a .jpg .gif or .png file // where watermark.gif is a mostly
    transparent gif image with the watermark - goes in the same directory as this script // ...
  3. Image Upload - ?!? (11)
    I need the image upload script which automatically resized the image by specified size and store it
    in the specified folder....
  4. Dynamic Image / Signature Generator - a simple code to change text on an image (12)
    In search of dynamically changing quote, saying or all other types of text on an image I came across
    a code that I have modified to fit my initial usage. This procedure requires two files and short
    knowledge of PHP. If you are familiar with Trap17's sig rotation code you will understand this
    procedure very fast. Code 1: dynamic_sig.php (you can rename this to index.php and you'll see
    at the end why) Code 2: a simple text file named anything (I will call it name.txt ) Code 1
    CODE <?php header("Content-type: image/png"); �...
  5. Wappy's Php Snippets - I will place here usefull php snippets and functions that i learn/use (13)
    Here is a function you can use to generate a simple random password for whatever use ;-) CODE
    <? function rand_pass($numchar){ $string = str_shuffle
    ("abcdefghijklmnopqrstuvwxyz1234567890"); $password = substr ($string,
    1, $numchar); return ($password); } //example echo
    rand_pass('8'); // will return an 8 character long random password of numbers and
    letters like c8k4ss42 ?> CODE tags added. Here is an extremly usefull search function
    that will search a directory and...
  6. Php Email Validation - A PHP data validation class with many functions (1)
    I've been reading through my old php book (PHP 4.1) and came across this data validation class.
    It can check a number of things ranging from telephone numbers , credit card number formats, email
    address and some others. I checked out some of the methods although I didnt expect it to work 100%
    because I've found source code errors thoughout the book and CD. I tested out a few of the
    methods to check and some of them did return expected results but some didnt either so the data
    validation class was not perfect and it didnt really bother me. The cool thing I found...
  7. Php And Flash Image Gallery - Need some help in creating or editing an xml file while viewing some o (5)
    Hello there and thanks for the helping hand you are offering. PHP newbie here! /ph34r.gif"
    style="vertical-align:middle" emoid=":ph34r:" border="0" alt="ph34r.gif" /> So here is my problem:
    On my website I have a flash image gallery.The way the gallery works is by uploading pictures in a
    folder and editing? an xml file.(pics.xml) where it adds the following code when you upload a
    picture: CODE <pictures>     <image location="nameofpicture1.jpg"
    desc="" />     <image location="nameofpicture2.jpg" desc="" /&#...
  8. Php Functions To Send Mail - (4)
    Which other methods to send mail from a form? I just know mail function, like: mail(string to,
    string subject, string message) Has anyother?...
  9. Arrays Outside A Function - Need to have arrays available to all functions. (3)
    I've got a bunch of arrays that i want to use for more then 1 function. when i declear the
    arrays outside a function i cant use it in a function. This code was originally written in
    javascript by another person but since I plan to use it and extend it with php I had to change it
    from javascript to php code. In the javascript code the arrays were decleared outside the functions
    with 'var arrayname' I read somewhere that declearing javascript variables with
    'var' gives it global access. Any ideas on how I can go about declearing 1 set of these
    arrays t...
  10. Get A Image Indentifier With Gd Library - GD library question (7)
    Hey fellow coders, I'm having a problem. If you output a im indentifier in php with gd libary.
    With this method for example: CODE <?
    header("(anti-spam-(anti-spam-(anti-spam-content-type:)))
    image/png"); $imgWidth = 50; $imgHeight = 50;
    $image=imagecreate($imgWidth, $imgHeight); $colorBlack =
    imagecolorallocate($image, 0, 0, 0);  // first color you define with colorallocate is
    also the color of the background of your image imagepng ($image); image...
  11. Trap17 Board Status Dynamic Image - (13)
    I was really board a few days ago and decided to make a trap17 board status image for my sig
    /tongue.gif" style="vertical-align:middle" emoid=":P" border="0" alt="tongue.gif" /> That is the
    current beta. I'm still working on it so that it might display the most recent post or
    somthing, i'm not sure. After I finish it ill give out the source code but if you want one
    right now you can pm me and ill set one up to get the info on your account ^.^ So I was wondering
    how you members liked it? You'll probably think that its a waist of time, but alas as I sai...
  12. Encrypt Functions - (0)
    Here is my 3rd Code: By this code you can encrypt your text: CODE <?php $a =
    md5("hello"); $b = base64_encode("hello"); $c =
    base64_decode("hello"); print "md5 = ".$a." base64_encode =
    ".$b." base64_decode = ".$c; ?> EASY!...
  13. Editing Drop Down Menu In Php - (3)
    suppose i make a dropdown menu having value 1, 2, 3, 4, 5, one option can be selected, and selected
    option is stored in database. now i create an edit page, how do i display the selected value in the
    menu and other values in dropdown, for example, Menu is like Select One 1 2 3 4 5 and i select 3,
    this 3 is stored in database, now on the edit page i want to show 3 as already selected, something
    like that.. QUOTE 1 2 3 4 5 I will be very thankful, if
    someone could help by explaining how do i make option 3 as selected.. eg. how i...
  14. [php](simple) Using Functions To Combine Values In A Form - Really simple example on how to combine values with function (2)
    I just learned this simple method on how to use functions to combine two values from a form. First
    we create ourselves a simple POST form CODE <form method="POST"> Name:
    <input type="text" name="nickname"> Location: <input
    type="text" name="location"> <input type="submit"
    value="Input"> </form> Now we add this php to that same file CODE
    <?php $nick = $_POST['nickname']; $location =
    $_POST['location' ...
  15. Flipping An Animated Gif Image W/ Gd Library - Help (1)
    I need an animated gif image flipped using GD library in PHP. I wrote a script to flip still
    images, but it doesn't work on animated images. This is probably because I have the script
    moving 1 column of pixels at a time, and switching them around. How would I make multiple frames?
    Any help would be great! Thanks!...
  16. Editing Information In A Mysql Database And Deleting Rows - (5)
    I need help with a couple of things. First, I need to know how to retrieve information from a mysql
    database and edit it then re add it to the database. I also would like to know how to easily delete
    a mysql row. And I want this done without going to phpMyAdmin. Thanks for the help!...
  17. Detect Image Resolution Without Gd - Also stop error if not found (1)
    Hi, I have come accross some starnge problem in PHP. I wanted to detect the image resolution in
    of a URL specified by the user. This is possible via getimagesize() function of PHP that is
    independent of GD library. But this function generates a E_WARNING Error if the image is not there.
    What shall i do to stop this warning ?? I dont want to show the Error in PHP style but my style of
    error reporting. Please help me....
  18. Gd Functions - Questions (2)
    Hi all I want begin a new project , my new project is Photo blog ( weblog and image album ) in one
    script for example you can post many image in one post at once case . so its very good and very easy
    but we have some problems . if you can plz help me to fix this problems for example : we need
    change image size for page speed ( we dont want show 16 image in one page ) * we need GD functions
    to change image size to smaller and then show smaller image at page if you know source or tutorial
    about change image size plz post here . thankx we know we can change image size (w...
  19. Looking For Php Script : Image Thumbnail Like Imageshack. - (2)
    Does anyone know a code like the one ImageShack uses, like this one. That would be just
    awesome, I hate doing it by hand, such a hassal. Until I can find a code similar to that, I think I
    will just use ImageShack....
  20. Image Galleres - (10)
    what is a really good image gallery i can hook up for my phpnuke site?? something easy to set up to.
    thanks...
  21. Regular Expressions - best way to repace strings (10)
    Hello! I as all of You use this greatful FORUM. But I want to know how engine of forum replaces
    post like CODE [color=red]TEXT[/color] to CODE <font
    color=red>TEXT</font> But I think that some Bbcodes like CODE
    [b][/b] maybe replaced by this method: CODE
    $str="[b]TEXT[/b]";
    $str=str_replace("[b]","<b>",$str);
    $str=str_replace("[/b]","</b>",$str); echo $...
  22. Some Php Functions Explaination Required - (2)
    Can some one please tell me what is the purpose of the following functions , although there's a
    little explaination with everyline but i cant understand, can some one exaplin it bit clearly and
    tell me that why it is needed in config.inc.php.. what is its purpose and will it work if i dont
    include these files in config.inc.php thanks QUOTE ### Url were Website has been installed, not
    '/' in end! define('C_URL','http://www.test.com/Website'); ### Internal
    path to Website directory define('C_PATH','Z:/home/www.test.com/www/...
  23. Php Photo And Image Gallery Script - PHP Photo And Image Gallery Script (2)
    This script is great and the documentation is excellent!! I have used it on my site without
    really knowing much about PHP. Script ...
  24. Image Upload And File Size - (2)
    Hi, I'm trying to upload rather large jpgs files (2560x1920 and ~ 2 megs in size) to my server
    via PHP. The problem I am having is that when I upload and attempt to resize by creating a new
    image, the new image is always black. Code I'm using is: PHP Code: CODE if(
    !empty($thefile_name) ) {                                                  
                                                 $query = "INSERT INTO coldwell_images
    (imagename) VALUES ('insertimage')";                    $result ...
  25. Globals Inside Functions - (4)
    I've got the following function, that has a function inside of it, when I run it I get the
    followin error: PHP Code: CODE Fatal error: Call to a member function on a non-object in
    See the code below where I get the error message. I'm guessing the scope of my varaibles is
    messed up, but I'm not sure how to fix it. I've abbreviated the code so as to make it easier
    to read. PHP Code: CODE function getMemberRegistrationForm( &$tpl, &$db ) {
       function displayRegistrationForm( $action, &$db, $defaults =...
  26. I Need A Php Editor - I need that for image editing (1)
    I need a php editor whichc can be used for the image editing like FrontPage for HTML. Can any body
    give a link for that...
  27. Editing Footer.php - adding a script (2)
    hey can somebody put this script into my footer.php file? because i don't know how. the script
    has to go between the and ok this is the script... CODE <!-- Clicksor.com Advertising
    Code Begin --> <script type='text/javascript'> <!--
    clicksor_layer_border_color = '#B4D0DC'; clicksor_layer_ad_bg = '#ECF8FF';
    clicksor_layer_ad_link_color = '#0000CC'; clicksor_layer_ad_text_color = '#000000';
    clicksor_text_link_bg = ''; clicksor_text_link_color = '#000FFF';
    clicksor_enable_pop = fa...
  28. Write Random Text To Image - PHP script help! (5)
    I'm trying to create a script that writes text to an image. CODE
    header("Content-type: image/png"); $_phrases = array( "Test 1",
    "Test 2", "Test 3", "Test 4", "etc." ); $_rand_phrase =
    $_phrases[rand(0,count($_phrases)-1)]; $_image =
    imagecreatefrompng("gmail.png"); $_user_width =
    imaagettfbbox(9,0,"tahoma.ttf",$_rand_phrase); $_x_value =
    (200-($user_width[2] + 113)); ...
  29. Writing Your Own Functions In Php - how do i write php functions that takes arguments in php? (2)
    I'll set up the background for the question: I have a separate file that I include on all the
    webpages on my site which I call with PHP using the include() function, so everything will be much
    easier to maintain and update. Well, I have three include files for each page: header.php (includes
    stuff like meta tags, googlebot/spider info), footer.php (the footer/copyright thing), leftnav.php
    (includes the navigation bar). I also like the titles of my pages to be as descriptive as possible
    so I try to include the path of a page (how the user got to that page: "Excite Y...
  30. A Function To Count The Number Of Lines In A String? - (4)
    I'm making a forum and I'm currently coding signatures. Is there a function that I can use
    to make sure that what the user inputs is a certain number of lines?...



Looking for image, editing, functions, php, specifically, lines, regular, polygons

Searching Video's for image, editing, functions, php, specifically, lines, regular, polygons
Functions
???
Watermark
Your Image
With Simple
Php Script
found it on
the net
Image Upload
?!?
Dynamic
Image /
Signature
Generator a
simple code
to change
text on an
image
Wappy's
Php Snippets
I will place
here usefull
php snippets
and
functions
that i
learn/use
Php Email
Validation A
PHP data
validation
class with
many
functions
Php And
Flash Image
Gallery Need
some help in
creating or
editing an
xml file
while
viewing some
o
Php
Functions To
Send Mail
Arrays
Outside A
Function
Need to have
arrays
available to
all
functions.
Get A Image
Indentifier
With Gd
Library GD
library
question
Trap17 Board
Status
Dynamic
Image
Encrypt
Functions
Editing Drop
Down Menu In
Php
[php](simple
) Using
Functions To
Combine
Values In A
Form Really
simple
example on
how to
combine
values with
function
Flipping An
Animated Gif
Image W/ Gd
Library Help
Editing
Information
In A Mysql
Database And
Deleting
Rows
Detect Image
Resolution
Without Gd
Also stop
error if not
found
Gd Functions
Questions
Looking For
Php Script :
Image
Thumbnail
Like
Imageshack.
Image
Galleres
Regular
Expressions
best way to
repace
strings
Some Php
Functions
Explaination
Required
Php Photo
And Image
Gallery
Script PHP
Photo And
Image
Gallery
Script
Image Upload
And File
Size
Globals
Inside
Functions
I Need A Php
Editor I
need that
for image
editing
Editing
Footer.php
adding a
script
Write Random
Text To
Image PHP
script
help!
Writing Your
Own
Functions In
Php how do i
write php
functions
that takes
arguments in
php?
A Function
To Count The
Number Of
Lines In A
String?
advertisement



Using The Image Editing Functions Of Php - Specifically, lines or regular polygons.



 

 

 

 

ADD REPLY / Got an Opinion! Remove these ADs! RAPID SEARCH! Free Web Hosting [X]
Express your Opinions, Thoughts or Contribute more info. to help others.
Ask your Doubts & Queries to get answers, So that "Together We can help others!"
Register FREE for AD-FREE forum, Create your own topics, Ask Questions, track topics, setup subscriptions & notifications and Get a Free Website w/ Email and FTP.
500MB Space *No Ads*, CPanel, FTP, PHP, MySQL, EMails - 100% FREE