samedi 18 avril 2015

Equally Divide the space from starting point in php

I'm making a file which take input from the user and paste it on an image I have used this php method to set location for the text



<?php
header('Content-type: image/jpeg');

$text = $_GET['name'] ;
$image_url="dump/".rawurlencode(trim($text)).".jpg";

// Check if the file doesn't exist, create it
if (!file_exists($image_url)) {
$jpg_image = imagecreatefromjpeg('Desert.jpg');
$white = imagecolorallocate($jpg_image, 73, 41, 236);
$font_path = 'OpenSans-Italic.TTF';
imagettftext($jpg_image, 25, 0, 75, 50, $white, $font_path, $text);
imagejpeg($jpg_image,$image_url);
imagedestroy($jpg_image);
}

readfile($image_url);
?>


Its tells the system where to start from as you can see in this coding I have given equal "X" and "Y" axis so the text appear on the center of the the image and move on to the the front side . I want the the text should not start from a point and goes into one direction i want that it moves both the sides in equal ration from the starting point given by us.


Aucun commentaire:

Enregistrer un commentaire