Jump to content
The Uniform Server Community

Curl / GD not working, pulling my hair out!


markswift
 Share

Recommended Posts

Hi Guys,

 

I have the latest version of Uniserver ZeroXL installed and running. I've transferred across from XAMPP and I wanted something lighter and less bloated.

 

The only issue I'm having is that one of my PHP scripts relies on curl and GD to pull images from my IP camera, sadly I cannot get this to work using Uniserver - it works fine with the default install of XAMPP.

 

The message displayed is attached, I've also ensured that both curl and GD are ticked under PHP modules.

 

Any help getting this resolved would be greatly appreciated, I've spent hours googling around and trying various things with no luck...

 

I also tried the following code in check.php and it just displays a blank page.

<?
// is curl installed?
if (!function_exists('curl_init')){ 
die('CURL is not installed!');
}

// create a new curl resource
$ch = curl_init();
echo "OK";
?>

post-6846-0-34034500-1429260449_thumb.png

post-6846-0-05523800-1429261604_thumb.png

SecureImageDisplay.php

Link to comment
Share on other sites

The above example code will not work because you are using short PHP tags Uniform Server defaults to using full PHP tags.



The following examples show curl and gd operation on a default installation 11_7_4_ZeroXI



curl example save as file z2.php



$image_url = "http://www.uniformserver.com/ZeroXI_documentation/common/images/us_zero_logo.png";
$ch = curl_init();
$timeout = 0;
curl_setopt ($ch, CURLOPT_URL, $image_url);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);

// Getting binary data
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1);

$image = curl_exec($ch);
curl_close($ch);

// output to browser
header("Content-type: image/png");
print $image;
?>

gd example save as file z3.php



header("content-type: image/png");
$src_img = imagecreatefrompng("images/logo.png");
$srcsize = getimagesize("images/logo.png");
$dest_x = $srcsize[0] / 2;
$dest_y = $srcsize[1] / 2;
$dst_img = imagecreatetruecolor($dest_x, $dest_y);

imagecopyresized($dst_img, $src_img, 0, 0, 0, 0, $dest_x, $dest_y, $srcsize[0], $srcsize[1]);
imagepng($dst_img);
imagedestroy($src_img);
imagedestroy($dst_img);
?>

To run type http://localhost/z2.php and http://localhost/z3.php



All the best


Ric


Link to comment
Share on other sites

  • 2 years later...

 

The above example code will not work because you are using short PHP tags Uniform Server defaults to using full PHP tags.

 

The following examples show curl and gd operation on a default installation 11_7_4_ZeroXI

 

curl example save as file z2.php

<?php
$image_url = "http://www.uniformserver.com/ZeroXI_documentation/common/images/us_zero_logo.png";
$ch = curl_init();
$timeout = 0;
curl_setopt ($ch, CURLOPT_URL, $image_url);
curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);

// Getting binary data
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, 1);

$image = curl_exec($ch);
curl_close($ch);

// output to browser
header("Content-type: image/png");
print $image;
?>

gd example save as file z3.php

<?php
    header("content-type: image/png");
    $src_img = imagecreatefrompng("images/logo.png");
    $srcsize = getimagesize("images/logo.png");
    $dest_x = $srcsize[0] / 2;
    $dest_y = $srcsize[1] / 2;
    $dst_img = imagecreatetruecolor($dest_x, $dest_y);

    imagecopyresized($dst_img, $src_img, 0, 0, 0, 0, $dest_x, $dest_y, $srcsize[0], $srcsize[1]);
    imagepng($dst_img);
    imagedestroy($src_img);
    imagedestroy($dst_img);
?>

To run type http://localhost/z2.php and http://localhost/z3.php

 

All the best

Ric

 

Is there some set of instructions which CLEARLY state how to activate that can be found ANYWHERE? It's probly me, but I've read every question where there was difficulty with enabling the module, and that stock answer about downloading from PHP.net the same module of PHP as the Uniform Server is about as useful to me as breasts on a man. Can I get a clearcut pointer to some current information? PLEASE?!?!?!?!?

Link to comment
Share on other sites

As it turns out...Google IS your friend in this case (lol!). Using the query "curlopt_cainfo option. Uniform Server", I was able to find a clue to my cURL dilemma, as well as anticipate for when I need access to the SSL extension for soon-to-come development. I've changed both the dev and production PHP ini files as I'm not sure which one is the default (posited the dev version, since I'm not using my box as an IIS platform). https://sorastation.com/tmp/JoomlaPC33/core/php54/php_production.ini - jarred loose confusion for me. Just seeing it laid out in front of me, led me to resolve this logjam myself, HTHSO.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...