Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 2 of 3 FirstFirst 123 LastLast
Results 16 to 30 of 31
  1. #16
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    Quote Originally Posted by angelali View Post
    Facepalm to myself. I need a weed I think. My head is too heavy to understand thing. So, if I copy and paste the script in another page then INCLUDE the page to the one, will it work?
    Nope, you can never include it in. It is an image, you can only use the output as an image such as in a <img> tag.

  2. #17
    Regular Coder
    Join Date
    Sep 2011
    Posts
    348
    Thanks
    39
    Thanked 0 Times in 0 Posts
    Well forget this crap! Im fed up of this!

  3. #18
    Regular Coder
    Join Date
    Nov 2012
    Posts
    115
    Thanks
    7
    Thanked 12 Times in 12 Posts
    Simple solution is to have your code save the image to a temporary name and load that into the page. That way you skip the header issue.

  4. #19
    Regular Coder
    Join Date
    Sep 2011
    Posts
    348
    Thanks
    39
    Thanked 0 Times in 0 Posts
    Or perhaps, it has nothing to do with the header but to the src of the image. I tries ob_start, flush, end flush etc, but in vain. In fact, all other websites I saw, they are doing the same as me and they are not getting errors. Do you think it has something to do with the src of the img tag?

  5. #20
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    Quote Originally Posted by angelali View Post
    Or perhaps, it has nothing to do with the header but to the src of the image. I tries ob_start, flush, end flush etc, but in vain. In fact, all other websites I saw, they are doing the same as me and they are not getting errors. Do you think it has something to do with the src of the img tag?
    The current source of your image tag is an .jpg indicating it is not this script. That image is already corrupt. You can point it at your script if you want, but if you are doing something like a watermark, I'd suggest it is much more efficient to write once and store the image than constantly writing the watermark. GD has a lot of overhead in it, so use it sparingly. If the data is supposed to be dyanmic (like, a barcode) then it makes sense to use the GD to build that at runtime.

  6. #21
    Regular Coder
    Join Date
    Sep 2011
    Posts
    348
    Thanks
    39
    Thanked 0 Times in 0 Posts
    This sucks. Wait, suppose I have an image on the page. I have a textbox below, and a user write some texts and press OK, the forms goes to another page, and output the text on the image which was the same on the page the user wrote the text, we cannot?

    Guys, can you help me on a last thing? Its not about issue but want to know something. Its better i ask to avoid losing time to try it.
    Last edited by Inigoesdr; 12-01-2012 at 12:17 AM.

  7. #22
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,502
    Thanks
    8
    Thanked 1,089 Times in 1,080 Posts
    Give us a link to your image so we can see it.

    We can give you an example of writing text on it.



    .
    Last edited by mlseim; 11-30-2012 at 05:02 PM.

  8. #23
    Regular Coder
    Join Date
    Sep 2011
    Posts
    348
    Thanks
    39
    Thanked 0 Times in 0 Posts
    Hi, sorry, but I abandoned the project. Thank you anyway.

  9. #24
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,502
    Thanks
    8
    Thanked 1,089 Times in 1,080 Posts
    Nooo ... don't abandoned it.

    At least post the image somewhere and let us play with it.
    Describe what text needs to be added (font ,size and color).
    It's easy to show a working example.

  10. #25
    Regular Coder
    Join Date
    Sep 2011
    Posts
    348
    Thanks
    39
    Thanked 0 Times in 0 Posts
    I will try a last time. Hope it will work.

  11. #26
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,502
    Thanks
    8
    Thanked 1,089 Times in 1,080 Posts
    Please post a link to the photo or image you have, and describe what
    needs to be put "embedded" into the photo ... text, font, color, etc.

  12. #27
    Regular Coder
    Join Date
    Sep 2011
    Posts
    348
    Thanks
    39
    Thanked 0 Times in 0 Posts
    I have tried y maximum to figure out how these websites are writing texts online on images but in vain. I thought it was HTML5 Canvas, but unfortunately, you cannot do that as if you want to edit a text, you have to reset the whole canvas. I switched to PHP GD, again the same thing, there is no multiline functionality either.

    Here is a little example what I want to do:

    http://www.someecards.com/usercards/create

  13. #28
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,502
    Thanks
    8
    Thanked 1,089 Times in 1,080 Posts
    Their program is much more elaborate than my example.

    But this is a simple example:
    http://www.catpin.com/card_sample/

    Since you won't give us an image to use, I'll make one up ...

    PHP Code:
    <?php 
    // Card Sample - Generator 

    // Get form variables
    $gfirst $_POST['gfirst'];
    $gmiddle $_POST['gmiddle']; 
    $glast $_POST['glast']; 
    $bfirst $_POST['bfirst']; 
    $bmiddle $_POST['bmiddle']; 
    $blast $_POST['blast']; 

    // Generate Image & set width 
    $image imagecreatefromjpeg("card1.jpg"); 
    $imageWidth imagesx($image); 

    // Generate Bride 
    $color imagecolorallocate($image1796366); 
    $font "mlsjn.ttf"
    $fontSize "24";

    // The hardest part will be to get the actual width of the text (in pixels).
    // This will be used to determine the position and margins.
    // In this example, I am not doing any math ... just using fixed positions.
    // But this is the way to get the text width 
    // $b1 = imagettfbbox($fontSize, 0, $font, $bfirst);
    // Then, instead of 95, you would do some math using $b1.
     
    imagettftext($image$fontSize095130$color$font$bfirst); 
    imagettftext($image$fontSize095165$color$font$bmiddle);
    imagettftext($image$fontSize095200$color$font$blast);

    // Generate Groom 
    $color imagecolorallocate($image1796366); 
    $font "mlsjn.ttf"
    $fontSize "24"
    //$ret = imagettfbbox($fontSize, 0, $font, $month); 
    imagettftext($image$fontSize0375130$color$font$gfirst); 
    imagettftext($image$fontSize0375165$color$font$gmiddle);
    imagettftext($image$fontSize0375200$color$font$glast);

    // Output & Free Memory 
    header("Content-type: image/jpeg"); 
    imagejpeg($image); 
    imagedestroy($image); 
    ?>

  14. #29
    Regular Coder
    Join Date
    Sep 2011
    Posts
    348
    Thanks
    39
    Thanked 0 Times in 0 Posts
    I did a card, but I abandoned when the multiline function does not work. Moreover, when you edit a textbox, or even remove a value, then click submit, it does not update the card. I mean on your example. This is why I lost courage earlier.

  15. #30
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,502
    Thanks
    8
    Thanked 1,089 Times in 1,080 Posts
    OK ...
    I would guess there are scripts, like the one you mention earlier, that you can purchase.


 
Page 2 of 3 FirstFirst 123 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •