Jump to content

bunnyali2013

Members
  • Posts

    43
  • Joined

  • Last visited

bunnyali2013's Achievements

Member

Member (2/5)

0

Reputation

  1. Huhh, if aI understand, the src should be like this: src="index.php"?
  2. Yes its on, in fact I made this: <?php ini_set('display_errors', 1); error_reporting(E_ALL); //header ("Content-type: image/jpeg"); $string = "This is my text"; $font = 4; $width = imagefontwidth($font) * strlen($string) ; $height = imagefontheight($font) ; $im = imagecreatefromjpeg("images/img.jpg"); $x = imagesx($im) - $width ; $y = imagesy($im) - $height; $backgroundColor = imagecolorallocate ($im, 255, 255, 255); $textColor = imagecolorallocate ($im, 0, 0,0); imagestring ($im, $font, $x, $y, $string, $textColor); imagejpeg($im); ?>
  3. I get rubbish code. I mean the codes of the image. I did this: //header ("Content-type: image/jpeg");
  4. Well, I have an image ans I want to write a text on it. The issue is, it is saying, image cannot be displayed because it contains errors. Refer to the screenshot below as attachment. Here the codes: <img src="images/img.jpg" width="500" height="300"> <?php header ("Content-type: image/jpeg"); $string = "This is my text"; $font = 4; $width = imagefontwidth($font) * strlen($string) ; $height = imagefontheight($font) ; $im = imagecreatefromjpeg("images/img.jpg"); $x = imagesx($im) - $width ; $y = imagesy($im) - $height; $backgroundColor = imagecolorallocate ($im, 255, 255, 255); $textColor = imagecolorallocate ($im, 0, 0,0); imagestring ($im, $font, $x, $y, $string, $textColor); imagejpeg($im); ?>
  5. Well, I have a page which has less content. I want to make my footer at full width which is OK, except, I cannot make it down to the page. Look the screenshot below, I want to place it just below the screen. Currently, it is showing below a div. #footer { width:100%; background-color:#000000; }
  6. Ok, this means we cannot do the change of text live. Ok, I thought a solution, I want you to tell me if it is good. Here is it below: -On a page, there is the image, some textboxes and drop down list to write the text, choose fonts, size and position etc..and the button. -All the textboxes and the button are in a form of course because there is a submit button. The image is outside the form. -When the user will write a text in the textbox, select the color, font etc..., they will NOT appear on the image directly, but in fact, stored in a database in a table after clicking the button. -After saving, the user will be redirected to another page to see the image with the text written on it. On this same page, there will be my codes to get the image from the page where the user has written the text, and also to get the texts stored in the database, to write it automatically on the image. In the same line of thought, if the user has made a mistake or simply want to change the text as a whole, he/she has to return back on the page where to write the text, save it again to the database and redirect to the other page to see the image with the current texts updated. Your opinion?
  7. The last question about editing is the most important. I will give you a little scenario where you can more understand. Suppose I have an image, a textbox and a button. A user will write the text on the image by typing in the textbox then click on the button to write. Good. Suppose now, after writing, the user saw he made a misspelling or simply want to clear the text to write another one. For that, he just simply use backspace to clear the previous text on the textbox, then write again, then click on the button to write on the image. I want to know will the previous text written on the image still be on the image or it will be edited according to the user's want? Here is an example of a website: http://yugico.com/yugioh-card-creator Write a text, and click on the button. The text appears, good. But now, clear the textbox or simply edit the text and click on the button again, the text is edited. This is what I want to do. I could use HTML5 canvas, but you cannot edit a written text or clear a text you wrote for another as it is pixel based. On canvas, you have to clear the whole canvas and start again.
  8. I want to know the following aspects about GD library in PHP, so here my questions: 1/ I know we can write text in PHP on image using GD library. Can we rotate the text? 2/ Can we rotate an image or a text? 3/ Can we add shadow on the text? 4/ Can we move the text on any place on the image? I mean write the text anywhere on the image? 5/ On HTML5 Canvas, when you write a text,you cannot erase it as it is based on pixel. You have to clear the whole canvas and start again. I want to know if with GD library, can you clear a text if you have made a mistake and write another? Thank!
  9. Seriously, HTML 5 Canvas really lacks functionality. I searched how to clear a text written on it, and all what I am getting is to clear the whole damn canvas. Moreover, clearing all itself is not working. Here are my codes: HTML <img src="jjj.jpg" width="252" height="144" id="image"> <canvas id="canvas" width="252" height="144"></canvas> <input type="button" onclick=" insertImg ();"> <input type="text" id="text"/> <input type="button" onclick="writeText();"> <input type="button" value="Clear" onclick="clearCanvas();"> Javascript //Draw image function insertImg () { var canvas = document.getElementById("canvas"); var context = canvas.getContext("2d"); var image = document.getElementById("image"); context.drawImage(image, 0, 0); } //Write text function writeText () { var canvas = document.getElementById("canvas"); var context = canvas.getContext("2d"); var style = 'italic'; var size = '50pt'; var family = '"Arial Black", Gadget, sans-serif' var text = document.getElementById("text").value; context.font = style + " " + size + " " + family; context.fillStyle = 'blue'; context.fillText(text, 50, 50); } //Clear canvas function clearCanvas () { context.clearRect(0, 0, 252, 144); } Everything is working correctly, except, the canvas is not clearing when I click on the clear button. I will be glad if we can clear the text also separately from clearing canvas as a whole.
  10. You are right Salathe! I have just been informed that checking file extension is lame as there are nay files, like Bash, which this extension checking will not work! It will not work on short-links as well. I think I will check the URL normally. Any last idea? Take example of this website: http://katzbb.com/submit.html, even it mentions to not post direct link files, I just tested it, and their validation did not work. It accepted a ZIP. Seems they did not make a validation as it will be useless!
  11. Exactly, I am not storing files on the server. If this was a file hosting, then things would be different. I cannot accept direct file link. I will try to do it as suggested earlier, with pathinfo(). I will post here if something goes wrong. By the way, I really wanted to make an image hosting, but this involves lot of security. MIME and file extension check up would be too basic. The damn Apache accepts more than one file extension on a file. .htcaccess has to be configured to accept only files, .htcaccess has to be outside the directory, files have to be stored in another directory outside, firewall should be configured, antivirus, mod_security stuffs, damn, forget that!
  12. Oh lol yes, I typed too fast and did not pay attention the semi-colon. @Mr Marcus, no, these are link validations. Suppose you come on my website, you insert a link, which will store in my database. I dont accept links which have file directly, like www.xxxx.com/abc.exe for example. Because these links stored in database will appear on a page, and if the links have files, when the user will click, ithe file will be downloaded straight-away. This is why I have to check. No fuiles are uploaded in my server, so MIME is useless I think as its not file upload.
  13. But does we do it like this? I mean the good is good? I cant use text editor on this computer else I would check it...
  14. Well, I will check if it has an extension, for example, does this work? if (($path_extension) == "exe") { echo "Error" };
  15. MIME type in link? I thought it applies only on file upload. But a MIME can be modified right?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.