Image Resize does not work

Ask a Question related to PHP Development, Design and Development.

  1. #1

    Default Image Resize does not work

    I am trying to change the size of a drawing so they are all 3x3.

    the script below is what i was trying to use to cut it in half ... I
    get errors.

    I can display the normal picture but not the results of the picture
    half the size. The PHP I have installed support 1.62 or higher. And
    all I would like to do is take and image and make it fit a 3x3.

    Any suggestions to where I should read or look would be appreciated.

    TIA

    ############### code ####################################
    <?
    $i = "$image.jpg";
    echo "<br>my working file is $i";

    $src = ImageCreateFromJPEG($i);
    $width = ImageSx($src);
    $height = ImageSy($src);
    $x = $width/2;
    $y = $height/2;
    $dst = ImageCreateTrueColor($x,$y);
    ImageCopyResampled($dst, $src, 0,0,0,0,$x,$y,$width,$height);
    ImagePNG($dst);
    ?>

    #################### error #########################################
    Warning: imagecreatefromjpeg: Unable to open '13727.jpg' for reading
    in /var/www/html/viewer.php on line 75

    Warning: imagesx(): supplied argument is not a valid Image resource in
    /var/www/html/viewer.php on line 76

    Warning: imagesy(): supplied argument is not a valid Image resource in
    /var/www/html/viewer.php on line 77

    Warning: imagecreatetruecolor(): requires GD 2.0 or later in
    /var/www/html/viewer.php on line 80

    Warning: imagecopyresampled(): requires GD 2.0 or later in
    /var/www/html/viewer.php on line 81

    Warning: imagepng(): supplied argument is not a valid Image resource
    in /var/www/html/viewer.php on line 82


    // Larry
    Sandwick Guest

  2. Similar Questions and Discussions

    1. Resize Bitmap image in image control in flex3
      I am loading an image in image control initially. Then I am applying color transform to that image and want to load that bitmap image in flex3. That...
    2. Resize image on the fly
      Does anybody know any custom tag or snippet that can resize image on the fly based on the user's selection, ie thumbnail 300x400 600x800 ...
    3. [Indesign 2.0.2] Image Resize
      Hi to all, if i put an image into a document can i resize and rotate it into InDesign o have i to do it always in Photoshop, like when I worked with...
    4. Resize uploaded image
      I want to resize the images that the user may upload on our server. What I want is to resize the width and the height. How to do so ?
    5. Dynamic image resize with php
      Hello, I'd like to insert a resized image in a html page. I know that using the html IMG tag it is possible to set the height and width...
  3. #2

    Default Re: Image Resize does not work

    Sandwick wrote:
    >
    > #################### error #########################################
    > Warning: imagecreatefromjpeg: Unable to open '13727.jpg' for reading
    > in /var/www/html/viewer.php on line 75
    >
    Error messages can be your greatest friend. Is the file 13727.jpg in
    /var/www/html? That's where it's probably looking, since that's where
    the PHP script is and you didn't provide an absolute path in the file
    name. You should probably do that, something like:

    $IMG_BASE = "/var/www/html";
    $FullImgName = "$IMG_BASE/$image.jpg";

    Joshua Ghiloni Guest

  4. #3

    Default Re: Image Resize does not work

    Joshua Ghiloni <jdg11@SPAM.ME.AND.DIE.cwru.edu> wrote in message news:<bdfjun$q0d$1@eeyore.INS.cwru.edu>...
    > Sandwick wrote:
    > >
    > > #################### error #########################################
    > > Warning: imagecreatefromjpeg: Unable to open '13727.jpg' for reading
    > > in /var/www/html/viewer.php on line 75
    > >
    >
    > Error messages can be your greatest friend. Is the file 13727.jpg in
    > /var/www/html? That's where it's probably looking, since that's where
    > the PHP script is and you didn't provide an absolute path in the file
    > name. You should probably do that, something like:
    >
    > $IMG_BASE = "/var/www/html";
    > $FullImgName = "$IMG_BASE/$image.jpg";
    thanks for the input that eliminated 3 of the errors !

    I now have the file identified, but it will still not display the
    picture in half. It now complains about the following?

    It looks like I do not have the right version, but my phpinfo() tells
    me I have 1.62 or higher support.

    See error below.
    ####################### Error ##############################
    Warning: imagecreatetruecolor(): requires GD 2.0 or later in
    /var/www/html/viewer.php on line 83

    Warning: imagecopyresampled(): requires GD 2.0 or later in
    /var/www/html/viewer.php on line 84

    Warning: imagepng(): supplied argument is not a valid Image resource
    in /var/www/html/viewer.php on line 85


    // Larry
    Sandwick Guest

  5. #4

    Default Re: Image Resize does not work

    Sandwick wrote:
    > Joshua Ghiloni <jdg11@SPAM.ME.AND.DIE.cwru.edu> wrote in message news:<bdfjun$q0d$1@eeyore.INS.cwru.edu>...
    > > Sandwick wrote:
    > > >
    > > > #################### error #########################################
    > > > Warning: imagecreatefromjpeg: Unable to open '13727.jpg' for reading
    > > > in /var/www/html/viewer.php on line 75
    > > >
    > >
    > > Error messages can be your greatest friend. Is the file 13727.jpg in
    > > /var/www/html? That's where it's probably looking, since that's where
    > > the PHP script is and you didn't provide an absolute path in the file
    > > name. You should probably do that, something like:
    > >
    > > $IMG_BASE = "/var/www/html";
    > > $FullImgName = "$IMG_BASE/$image.jpg";
    >
    > thanks for the input that eliminated 3 of the errors !
    >
    > I now have the file identified, but it will still not display the
    > picture in half. It now complains about the following?
    >
    > It looks like I do not have the right version, but my phpinfo() tells
    > me I have 1.62 or higher support.
    >
    > See error below.
    > ####################### Error ##############################
    > Warning: imagecreatetruecolor(): requires GD 2.0 or later in
    > /var/www/html/viewer.php on line 83
    >
    Am I missing something? You have 1.62 or higher. The error message says you need 2.0. Presumably, you have
    something between 1.62 and 2.0. You'll need to upgrade.

    Shawn
    --
    Shawn Wilson
    [email]shawn@glassgiant.com[/email]
    [url]http://www.glassgiant.com[/url]


    Shawn Wilson Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139