Comunidad de diseño web y desarrollo en internet online

Como puedo lograr hacer esto con GD

Citar            
MensajeEscrito el 05 May 2009 12:21 pm
hola quisiera ser esto http://www.trikool.com.pe/hi5s/revista/ , se que se hace con GD php , pero este scirpt a a vez que genera la imagen se sube a imageshack .

No lo necesito exacto solo un ejemplo.

espero su ayuda :)

Por briand

6 de clabLevel



 

msie7
Citar            
MensajeEscrito el 05 May 2009 02:53 pm
tu problema es con la conexion pagina-imageshack?
para eso se necesita la api de imageshack
http://reg.imageshack.us/content.php?page=developer

si lo que quieres es el sobreponer las imagenes con GD
http://www.elguruprogramador.com.ar/articulos/marcas-de-agua-automaticas-con-php-y-gd.htm

Por tribak

Claber

2448 de clabLevel

6 tutoriales

Genero:Masculino   Héroes

Fotógrafo o algo

firefox
Citar            
MensajeEscrito el 05 May 2009 08:21 pm
aqui esta el api

Código :

$uploadType = 'file';

if($uploadType == "post"){

   /* Sample upload form to use:
      <form method="post" action="xmlapi.php" enctype="multipart/form-data">
      <input type="hidden" name="MAX_FILE_SIZE" value="1048576">
      <input type="file" name="fileupload" size="30">
      <input style="width: 100px;" type="submit" value="host it!" >
      </form>
   */

   if(!$_FILES[fileupload]){ exit; }
   $source = $_FILES[fileupload][tmp_name];
   $dest = '/tmp/'.$_FILES[fileupload][name];
   copy($source,$dest);
   $xmlString = uploadToImageshack($dest);
   unlink($source); unlink($dest);

} elseif($uploadType == "file"){

//specify location of file
   $dest = 'http://mundorisa.es/xmlapi.php?img=water';
   $xmlString = uploadURLToImageshack($dest);

}

//begin parsing xml data

if ($xmlString == 'failed') { echo "XML return failed"; exit; }

$xmlData = explode("\n",$xmlString);

foreach($xmlData as $xmlDatum){

   $xmlDatum = trim($xmlDatum);

   if($xmlDatum != "" && !eregi("links",$xmlDatum) && !eregi("xml",$xmlDatum)){

      $xmlDatum = str_replace(">","<",$xmlDatum);
      list($xmlNull,$xmlName,$xmlValue) = explode("<",$xmlDatum);
      $xmlr[$xmlName] = $xmlValue;

   }

}

/*-----------------------------------------------------------------------------
available variables:
image_link: link to image, like: http://img214.imageshack.us/img214/7053/creative0cj.jpg
thumb_link: link to image thumbnail, like: http://img214.imageshack.us/img214/7053/creative0cj.th.jpg
ad_link: link to imageshack page on which image is displayed, like: http://img214.imageshack.us/my.php?image=creative0cj.jpg
thumb_exists: specifies whether thumb exists, either 'yes' or 'no'
total_raters: specifies how many people rated image, numerical string
ave_rating: specifies the average rating value, numericl string between 1 and 10
image_location: internal-style link to image, like: img214/7053/creative0cj.jpg
thumb_location: internal-style link to image thumbnail, like: img214/7053/creative0cj.th.jpg
server: server name on which image resides, like: img214
image_name: filename of image after it has been uploaded, like: creative0cj.jpg
done_page: link to imageshack page on which users can get linking code, like: http://img214.imageshack.us/content.php?page=done&l=img214/7053/creative0cj.jpg
resolution: pixel resolution of image, like: 300x250
------------------------------------------------------------------------------*/

//sample return
echo   'Upload successful!<br /><br />
   <a href="'.$xmlr["ad_link"].'"><img src="'.$xmlr["thumb_link"].'" border="0" /></a>
   <br /><br />
   Resolution: '.$xmlr["resolution"].'.';


//two functions, one for uploading from from file, the other for uploading from url, editing below this line advised only to those who know what they are doing :)

        function uploadToImageshack($filename) {
                $ch = curl_init("http://www.imageshack.us/index.php");

                $post['xml']='yes';
                $post['fileupload']='@'.$filename;

                curl_setopt($ch, CURLOPT_POST, true);
                curl_setopt($ch, CURLOPT_HEADER, false);
                curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
                curl_setopt($ch, CURLOPT_TIMEOUT, 240);
                curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
                curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect: '));

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

                if (strpos($result, '<'.'?xml version="1.0" encoding="iso-8859-1"?>') === false) {
                        return 'failed';
                } else {
                        return $result; // XML data
                }
        }

        function uploadURLToImageshack($url) {
                $ch = curl_init("http://www.imageshack.us/transload.php");

                $post['xml']='yes';
                $post['url']=$url;

                curl_setopt($ch, CURLOPT_POST, true);
                curl_setopt($ch, CURLOPT_HEADER, false);
                curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
                curl_setopt($ch, CURLOPT_TIMEOUT, 60);
                curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
                curl_setopt($ch, CURLOPT_HTTPHEADER, array('Expect: '));

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

                if (strpos($result, '<'.'?xml version="1.0" encoding="iso-8859-1"?>') === false) {
                        return 'failed';
                } else {
                        return $result; // XML data
                }
        }
      }

pero como puedo hacer para que se adapte con imagens GD
lojunto pero la imagen GD se muestra no deja mostrar al codigo

Por briand

6 de clabLevel



 

msie7
Citar            
MensajeEscrito el 05 May 2009 10:26 pm
what?

Por tribak

Claber

2448 de clabLevel

6 tutoriales

Genero:Masculino   Héroes

Fotógrafo o algo

firefox
Citar            
MensajeEscrito el 06 May 2009 03:54 pm
creo que alguien publico algo asi lo que tienes que hacer es generar la imagen en disco para despues enviarla a los servidores de imagehack sino no podras enviarla

Por talcual

686 de clabLevel



 

Colombia

firefox
Citar            
MensajeEscrito el 08 May 2009 02:59 pm
bueno ya lo he logrado gracias por su ayuda ...

Por briand

6 de clabLevel



 

msie7

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.