Jump to content

Lykos22

Members
  • Posts

    44
  • Joined

  • Last visited

Posts posted by Lykos22

  1. I'm having a problem and i'd like some help please. I have made a script for creating an image with PHP using GD library, but the problem is when i preview it on the Firefox it shows me an error in Firebug: "Image corrupt or truncated:localhost/my_scripts/images.php". NOTE: this is not an error displayed from PHP, it seems more like an error comming from the browser.I have checked my code for syntaxes many times, i have also tried out and other gd functions, like imagegif, imagettftext etc etc but didn't have any effect. Here's my code:

    <?php//$image = @imagecreate(200, 20)or die("Cannot Initialize new GD image stream");$image = imagecreate(200, 20);$background = imagecolorallocate($image,0,0,0);$foreground = imagecolorallocate($image,255,255,255);imagestring($image,5,5,1,"This is a Test",$foreground);header("Content-type: image/jpeg");imagejpeg($image);imagedestroy($image);?>

    GD library is enabled i've already checked that in phpinfo(), and I have also tried to preview it and on Chrome and looks the same. Any ideas what i might doing wrong or why happens this? and how can i fix this error??

  2. Thanks for the reply! Ehh .. just one more question please, more general. I was watching some videos on youtube about hosting, watching pretty much the progress with filezilla etc, but i was just wondering, for example a web development company hosts all the sites with the same way (getting domain, setting up a database etc etc), or they have their own database and they upload the sites they create in a subfolder in their site? Does the sub-domains that most hosting-companies offer has anything to do with this?

  3. Hi, i' going to create a simple blog with php and mysql as an exercise for my college and i thought it would be a great idea to host it online for the day of presentation. I don't know much about web hosting, so i thought this would be a great chance to learn also how to host a website.I would like to know if or whether i have to make any changes in my html or php when i have to move my blog from localhost (using xampp) to the server, so in which points should i pay attention. For example my connection file (localy in xampp) i have set it up like this:

    $host = "localhost";$username = "root";$password = "";$database = "my_blog";$connection = mysql_connect($host, $username, $password);$select_db = mysql_select_db($database, $connection);

    What exactly changes do i have to make in here? Does this also has to do anything with this http://w3schools.invisionzone.com/index.php?showtopic=45537 ?

  4. Thanks for the reply. Ok so if i understand it right from phpmyadmin i add a user to manage the database form the backend, as adeveloper for example, and thats all. The administrator of the (membership) site has nothing to do with that. Or for example in a personal site i set a root user for managing the db and a mysql user(admin) for editing content etc etc, right?

  5. Hi i'd like to ask a question about adding a user from phpmyadmin > privileges, cause i haven't totaly cleared this in my mind.Could you tell me in which exactly cases should i do this? is it something i should always do? I've seen many people do this.Personaly what i 'm used to doing is, if for example i have a membership site, with administrator(s), moderators and simple users, i have a table in my database named users and in this i have a collumn named admin, which is 0 for simple users, 2 for moderators and 1 for administrator etc etc.Is this (my way) the same to the one i'm refering to, or not?

  6. Gradients are usually done with 1px thin images that are repeated vertically or horizontally as CSS.
    I guess this is best made in case of linear gradients .. In radial i think is a little bit difficult as the color does not change always at the same point ( as it has a cyrcle shape). but in this case i'm refering if you notice there are 3 radial gradients, which i think is a little bit difficult to write it with css code.
  7. You can do it in css3 Now to the guy who posted:I agree with the other guy, you should leave coding to a human, not software, they muck it up. I would also stay away from too fancy of css3 features for now because ie6-8 are still used, and we are not out of the dark ages yet. It's also good practice to learn how to do some things the hard way. Do the w3school tutorials, or paste some codes with your specific problems. Glad to help.
    Thanks for the reply. If I understand your post right, me too i prefer to work this way. I'm not relying on Photoshop or Fireworks to generate my html, but i re-create the whole thing, that i get from the mock-up with HTML and CSS code in an editor. Instead of css3, can do the gradient as an image-graph?
  8. Hi, i'd like some feedback please, if its possible. I 've found this article ( http://webdesign.tutsplus.com/tutorials/complete-websites/create-a-dar k-clean-website-design-in-adobe-photoshop-free-psd/ ) that teaches how to design a website in photoshop. I can guess how is going to be the structure of the html and css in general, when turning this psd mock-up to an html document, but my main focus is on the coding process of banner/ slider area of the website, and i'd like to know which is the best or more efficient way to code it in some parts, like:

    1. the gradient background: is it better to code it with css or export it as an image-graph and add it as a background to a div [like background-image:url('image.jpeg') ]? NOTE that there are 3 gradients (step 8 of the article).
    2. the shadow effect: how can i make the shadow look like this? it does not extend to the full width of the slider and also has a different shape. Generally the shadow effect look like this http://www.w3schools...css3_box-shadow , but the one in the article looks totaly different.
    3. Finally about the slider and the logo: both look like they are standing on top/in front of the layout, is this has to do with the z-index property? both are are not placed in the same height as their sections, they are possitioned/go more 'downwards', how is better to do it? by using some margin or padding or maybe setting their positions (top, bottom, relative absolute ... )?

    Please note that i'm talking about the development process, when creating an html document (html & css) in dreamweaver or any other editor, NOT how to design the mock-up.

  9. While i was browsing in the forum i saw at the top of the section a pinned topic 'Tutorial ...' and i thought of this 'Tutorials Section' . I'm not quite sure whether there's already a section like this in the forum (if yes sorry for posting this topic), or if there are many topics-tutorials like this, but i think a section like this might be helpful.What i have in mind is some tutorials that cover the basics, the fundamentals or the general guide in some projects, for example making a login-register system with php & mysql, or maybe a custom cms, or perhaps a shopping cart / e-shop, maybe a blog, or a guestbook, or newsletter, or a rating system etc etc.Again what i'm telling is to give the general idea and the basics of how to create a project and then its up to the developer what or if he/she needs to add some more functionality.

  10. Hi ericpollard, you did a great job! really i like it a lot! :good:I like very much the design, and also the functionality (navigation, form proccess on the payment) is very cool! I'm quite new to web development - junior developer - ,i think my knowledge in php, mysql, css is in an acceptable level and i know some jquery. I'm currently trying to learn about e-commerce sites and basicly i have to make a custom e-shop website (not based on any platforms like magento, x-cart etc) as an excersice for my university, but i would like though to make it look like more professional, if you get me, just in case i might use it for the future. :Pleased: Well, the list of the products, the categories etc, with a little bit hard try and some hours of hard coding, i guess i cant make it. My main problem is with the payment methods. How can i develop the methods like 1. using paypal 2. using a credit cart (master card, visa etc etc) and 3. with check and 4. on delivery. I would be extremly grateful if you could give me some feedback, or if you have used some tutorial or article as a guide that explains well and with details the workflow.Any help would be appreciated.

  11. Hi, i'd like some help please. I have a gallery page that contains albums and i'd like to put to the album an image cover that can be updated anytime, but i'm not quite sure how to do that.In the admin area (shown in the image i uploaded) i have a page that displays in a do-while loop all images that belong to a specific album and in order to set the cover for the album i have to choose an image by clicking a radio button.

    <table width="100%" border="0" align="left" cellpadding="5" cellspacing="0" id="images">        <tr align="left">            <th>Inc. Id</th>            <th>Image:</th>		    <th>Album Cover:</th>            <th>Delete</th>	    </tr>        <?php do{ ?>        <tr>            <td><?php echo $row_images['image_id']; ?></td>            <td><img src="../_uploads/<?php echo $row_images['album_name']; ?>/<?php echo $row_images['image_name'].".".$row_images['image_ext']; ?>" width="150" /></td>            <td><input type="radio" name="cover" value="<?php echo $row_images['image_id']; ?>"  /></td>            <td><input type="checkbox" name="del[]" value="<?php echo $row_images['image_id']; ?>" /></td>        </tr>        <?php }while($row_images = mysql_fetch_assoc($get_images)); ?>        <tr>            <td> </td>            <td> </td>            <td> </td>            <td><input type="submit" name="submit" id="submit" value="Ok" /></td>        </tr>    </table>

    How can i do that?

    post-60268-0-39862200-1346922336_thumb.jpg

  12. first just run the captcha.php directly from the browser. what does it show to you?
    FF shows a message 'Cannot prview image "localhost/mysite/_includes/captcha.php" because having errors'and if I view source the contact.php shows <img src="_includes/captcha.php" />
  13. you dont need to start session using session_start() in every page. using it in the top of the included page will work fine.when that session satrted error is showing because it is making an output to the browser. once a output started you cant send another header so that image header is not working. that is the reason for broken image.
    Exactlly! that's why I ve put session_start in here <?php require_once("_core/init.php"); ?> and put comments to the next one. But then it doesn't show any image at all
  14. Ok so in contact.php i have: <?php require_once("_core/init.php"); ?> /// in init.php i have already session_start();<?php//session_start();$_SESSION['captcha'] = rand(100000,999999);if(empty($_POST) === false){ //grab the inputs $name = trim($_POST['name']); $email = trim($_POST['email']); $phone = trim($_POST['phone']); $message = trim($_POST['message']); $captcha = trim($_POST['captcha']); ........ <label for="captcha">Please type the code you see (*):<br /> <img src="_includes/captcha.php" /></label><span id="spryCaptcha"> <input type="text" name="captcha" id="captcha" tabindex="50" /><span class="textfieldRequiredMsg">You have to submit this field.</span><span class="textfieldInvalidFormatMsg">Invalid format.</span></span><br /> <p> </p> but shows no image. And inside _includes folder in captcha.php : <?phpsession_start();header("Content-type: image/jpeg");$text = $_SESSION['captcha'];$font_size = 20;$image_width = 200;$image_height = 40;$image = imagecreate($image_width, $image_height);imagecolorallocate($image, 255,255,255);//rgb white$text_color = imagecolorallocate($image, 0,0,0);for($i=1; $i<=30;$i++){ $x1 = rand(1,100); $x2 = rand(1,100); $y1 = rand(1,100); $y2 = rand(1,100); imageline($image, $x1, $y1, $x2, $y2, $text_color);}imagettftext($image, $font_size, 0, 15, 30, $text_color, 'georgia.ttf', $text);imagejpeg($image);?> Some added feedback:If i remove comments from the 2nd session_start() it shows a broke image icon and also displays a warning that already has started a session (because of the first one in init.php)I also tried to make it with imagestring() function but didn't work.

  15. you have to keep track of the numbers you randomly generating and store it in session and in the form you need to check against the session if it is matching or not. CAPCTAHCA usualy dont work like this. it generates some alphanumeric numbers and makes the image dynamically using http://php.net/gd2 GD image library
    I have already tried tthe GD image library but didn't display the image, although I have gd library installed
  16. Hi I would like some help please.I 've created a contact form and i would like to add some captcha. I have created some gif images, that have numbers with some noise added on, and named themcode_01.gif for no1,code_02.gif for no2etc etc.Firstly I have put some of them on my form, staticly, for display purposes like this: <label for="captcha">Please type the code you see (*):<br /><img src="images/code_01.gif" width="18" height="30" /><img src="images/code_07.gif" width="18" height="30" /><img src="images/code_01.gif" width="18" height="30" /><img src="images/code_08.gif" width="18" height="30" /><img src="images/code_03.gif" width="18" height="30" /><img src="images/code_07.gif" width="18" height="30" /><input name="captcha" type="text" id="captcha" /></label><span id="spryCaptcha"> <input type="text" name="captcha" id="captcha" tabindex="50" /><span class="textfieldRequiredMsg">You have to submit this field.</span><span class="textfieldInvalidFormatMsg">Invalid format.</span></span><br /> So in order to put some functionality in and show randomly 6 digit images i made this and work fine: <label for="captcha">Please type the code you see (*):<br /> <?php for($i=0; $i<=5; $i++){ ?> <img src="_assets/captcha/code-0<?php echo rand(0,9); ?>.gif" width="18" height="30" /> <?php } ?></label> Everytime I refresh the page, 6 new numbers generate. My problem is how to check that the combination of the random images will match with the combination of numbers that user enters in the input field in order to work captcha correct??Any help would be appreciated.

×
×
  • Create New...