Skip to main content

imageantialias call to undefined function error with GD installed


I need help with a php script. It is a CMS that has been implemented into a website. When trying to add a new product IMAGE or trying to edit current images, I am getting the following error:



Fatal error: Call to undefined function imageantialias() in /home/mounts/home/m/mclh/web/admin/library/functions.php on line 233



This is my code for that area:




if ($tmpDest['extension'] == "gif" || $tmpDest['extension'] == "jpg")
{
$destFile = substr_replace($destFile, 'jpg', -3);
$dest = imagecreatetruecolor($w, $h);
imageantialias($dest, TRUE);
} elseif ($tmpDest['extension'] == "png") {
$dest = imagecreatetruecolor($w, $h);
imageantialias($dest, TRUE);
} else {
return false;
}



Line 233 is the 5th line down.


Source: Tips4allCCNA FINAL EXAM

Comments

  1. UPDATE: It seems the function imageantialias() is only available if PHP is compiled with GD, so it is not enough to have the extension included via extension file.

    From the PHP manual:


    Note: This function is only available
    if PHP is compiled with the bundled
    version of the GD library.


    Please check your phpinfo() and see, if you find the flag --with-gd=shared (or a similar flag, maybe just --with-gd) in there. If you can't find it, your PHP has to be recompiled with this flag.

    In more details:
    PHP extensions can either be loaded by including a .dll (Windows) or .so (Unix) file via php.ini or they can be compiled with PHP. Compiling sounds scary and crazy but it is actually really easy. All you need to do (Unix) is:


    copy the compile string which is shown in your phpinfo()
    add the required new flag
    run

    ./configure ... all the stuff from your phpinfo plus the new flag
    make clean
    make
    make install

    look at your phpinfo() and smile :)




    First answer (didn't turn out to be correct):

    imageantialias() is a function of the PHP GD extension. Is GD installed and properly configured?

    From your code it seems that GD is installed because imagecreatetruecolor() is also a GD function and seems to work. This leads to the conclusion that you're using a PHP version prior to 4.3.2, which doesn't support imageantialias().

    Please look at your phpinfo() to see if my conclusions are correct. There you will see what version of PHP your are using and you will also see if GD is installed and working!

    ReplyDelete
  2. This function is part of the GD library. The library may not be installed in your PHP environment.

    Details how to include GD can be found here: http://www.php.net/manual/en/image.installation.php

    ReplyDelete
  3. That means you either spelled the imageantialias() function incorrectly or you haven't defined that function in your code or the third party code it belongs to wasn't included in your current document.

    UPDATE:
    GD is installed. This is a mystery.

    ReplyDelete

Post a Comment

Popular posts from this blog

[韓日関係] 首相含む大幅な内閣改造の可能性…早ければ来月10日ごろ=韓国

div not scrolling properly with slimScroll plugin

I am using the slimScroll plugin for jQuery by Piotr Rochala Which is a great plugin for nice scrollbars on most browsers but I am stuck because I am using it for a chat box and whenever the user appends new text to the boxit does scroll using the .scrollTop() method however the plugin's scrollbar doesnt scroll with it and when the user wants to look though the chat history it will start scrolling from near the top. I have made a quick demo of my situation http://jsfiddle.net/DY9CT/2/ Does anyone know how to solve this problem?

Why does this javascript based printing cause Safari to refresh the page?

The page I am working on has a javascript function executed to print parts of the page. For some reason, printing in Safari, causes the window to somehow update. I say somehow, because it does not really refresh as in reload the page, but rather it starts the "rendering" of the page from start, i.e. scroll to top, flash animations start from 0, and so forth. The effect is reproduced by this fiddle: http://jsfiddle.net/fYmnB/ Clicking the print button and finishing or cancelling a print in Safari causes the screen to "go white" for a sec, which in my real website manifests itself as something "like" a reload. While running print button with, let's say, Firefox, just opens and closes the print dialogue without affecting the fiddle page in any way. Is there something with my way of calling the browsers print method that causes this, or how can it be explained - and preferably, avoided? P.S.: On my real site the same occurs with Chrome. In the ex