Jump to content

bunnyali2013

Members
  • Posts

    43
  • Joined

  • Last visited

Everything posted by bunnyali2013

  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?
  16. well first i check if the textfield to write URL is empty then post an error message. Then I check the URL to see if it is valid using regular expression or FILTER_VALIDATE_URL. If not valid, error message. Then I check if the URL contains extension. If yes, error message, else proceed. Good? By the way, $path_arr['extension']; Can I check many extension together?
  17. I know how to validate URL in PHP by using the FILTER_VALIDATE_URL or simply, using regular expression. However, I want to know how I can validate a URL to see if it contains file. For example: www.xxxx.com/abc.exe, www.xxxx.com/abc/abc.jpg, etc... As you see, the links contain a file, one has an executable and the other has an image. I want to know, how I can validate a URL to know if it has a file or not? Because I do not want URL with contain file to be in my form! So, any regular expression or other way to do that?
  18. This is what I wanted LOL, about the ID.. thank you... I will implement all soon, if Ia find issues, I will post. Thank!
  19. Yes this is ok, but how to target the specific flagged comment in the database row? By its ID?
  20. I think you have not understood the whole thing! Ok, I will try to explain it easily. I have a table in my database which record comments. The table has 4 columns (User, comments, date and flag). The table will be displayed on a web page except for the flag column not. The flag column will be empty in the database for each comment. On the web page now, at the right of each row, there is a flag button where people can click to report as spam. I mean the flag button is for each comment. I want to know, how to make something, where when a person has clicked on the flag button of a particular comment, I will get a notification in my database that this comment has been flagged by spam? When the person will flag the comment, a text like "Flagged" will be written in the row of the comment in the flag column in the database table. How to do that?
  21. Yes I know! I mean for example look at this forum, there is a "flag report" above on each post. I want the same but perhaps more direct. I mean a user will click on a button, and I will get a notification. I mean, how I should proceed this? I want ideas, I will try to make it myself!
  22. I want to know, how to make a report or flagging system for spam comments? Suppose I have a table which is displayed from my database. In the table there are 3 columns, the first for name, the second for comment and the third is a button where a people can click to report as spam. I want to know how I can get the notification in MySQL? I mean how to proceed or what ways I can do it?
  23. I am not a programmer, I am more on design side. I know PHP procedural and it will be in some weeks I will learn a bit about classes stuffs. One thing is sure, we have more people who code OO badly. Using classes in your codes does not mean they are OO, this is what a programmer with 15 years of experiences told me. He gave me an example! Moreover, PHP was created in Procedural, this damn OO came in 2004. In fact it is not 100% true OO like other REAL OO based languages. As usual, there are more big-headed so called "programmers" as well. They are defining some classes, and voila, they think they have coded in OO. Most of them are poor in object design and pattern! I think this aspect to differentiate OO and Procedural is LAME. I asked this question earlier here on this forum. In all these OO websites in PHP which exist, how many are TRULY OO? How many are good OO coded websites? I bet not more than 20%. Facebook was procedural in 2004 and small part OO. In 2006, they started making all the codes OO. In 2008 I think, they started using C++ to compress the PHP codes. We had good advanced websites in PHP procedural before OO took place. Nobody gave a s*** at that time! So why now? The web changes? Yes, only front-end, back-end remains the same! OO can have advantages, but also drawbacks. It is damn difficult to start. Procedural also has advantages and drawbacks. I really hope Ruby, Python grow more even they will not. PHP is decreasing in number of use. Believe me or not, if major CMS were not in PHP, perhaps Ruby would beat it. I am sad of Coldfusion, another powerful and easy language which has died! Personally, I think you should work what you think is good. Yes, learn OO if you don't know, but it depends on you and also it depends on the project.. As I am not a programmer, I don't care OO too much but I will learn it. I don't know what you are, but if you are planning to have a career as PHP developer (which I do not recommend you as back-end is really boring), then you have to learn OO. Bear in mind, you don't find too much tutorials on OO than procedural even today. Procedural will continue to live like a BOSS. If procedural dies tomorrow, which is the origin of PHP, then I will leave PHP forever and may will do the same. Learning the same language which is based on two different styles is more difficult than learning one language as a whole!
  24. Well, I am not a programmer. I have a diploma in IT but not in computer science field. I am more like a designer but I know some server side stuffs like MySQL and PHP (Procedural). I am making a website where people will share texts. There will be registration and login, then the user account where the user can edit his/her account settings and delete his/her text uploaded if he/she wants. There will be a form to post the texts. There will be a pagination. Of course, all will be in database and with security. I know many will say OO is better etc...bla bla bla. But the website I will make is not huge or complex like Facebook, Amazon or even other bulky websites. So, I can go with Procedural? By the way, Procedural is not dead, in fact it is still used more on medium-sized application. It is not a matter I do not want to learn OO, but, the website I am doing is not huge at all! Some functions that's all, and I dont have an issue to update the codes. In fact, it will not be updated too much. Your opinion?
×
×
  • 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.