Jump to content

ImageMagick in Host. I can't convert to thumbnails!


it works!!!

Recommended Posts

The photo is added physically and in XML but the thumbnail isn't created.

Am I doing smth wrong?

Thank you!

 

 

 

 

<?php

 

  $category=$_POST['category'];

  $intro=$_POST[intro];

  $object=$_POST[object]; 

  $description=$_POST[description];

 

  $upload_dir="foto/";

  $upload_image=$upload_dir.$category.'/'.basename($_FILES[userfile][name]);

  $tmb=$upload_dir.'thumbs/'.$category.'/'.basename($_FILES[userfile][name]);

 

  $thumb='www/clicktirana.com/galery/'.$tmb;

  $image=basename($_FILES[userfile][name]);

  $up='www/clicktirana.com/galery/'.$upload_image; 

 

  echo "<p>";

 

  if (move_uploaded_file($_FILES[userfile][tmp_name],$upload_image))

  {

  echo "Photo successfully uploaded!";

 

  //thumbnail part

 

// use of ImageMagick

 

$imagemagickPath='/usr/lib/perl5/convert';

$cm="/usr/lib/perl5/convert -resize 60x50 $up $thumb";

exec($cm);

 

      }

 

  else{

      echo "Upload failed!";

      }

 

 

 

class Gallery extends DomDocument

{function _construct()

{

  parent::_construct();

 

}

 

 

 

function addPhoto($category,$intro,$object,$description,$tmb,$upload_image)

 

{

echo "<p>";

$cat=$this->createElement("category");

$title=$this->createAttribute("title");

$value=$this->createTextNode($category);

$title->appendChild($value);

$cat->appendChild($title);

 

$inf=$this->createAttribute("intro");

$value=$this->createTextNode($intro);

$inf->appendChild($value);

$cat->appendChild($inf);

 

echo "\n";

 

 

$obj=$this->createElement("object");

$title=$this->createAttribute("title");

$value=$this->createTextNode($object);

$title->appendChild($value);

$obj->appendChild($title);

$cat->appendChild($obj);

 

echo "\n";

 

 

$item=$this->createElement("description");

$cdata=$this->createCDATASection("$description");

$item->appendChild($cdata);

$obj->appendChild($item);

 

echo "\n";

 

 

$item=$this->createElement("thumbnail_path");

$titletext=$this->createTextNode($tmb);

$item->appendChild($titletext);

$obj->appendChild($item);

 

echo "\n";

;

 

$item=$this->createElement("photo_path");

$titletext=$this->createTextNode($upload_image);

$item->appendChild($titletext);

$obj->appendChild($item);

 

$this->documentElement->appendChild($cat);

}

 

}

 

 

 

$dom= new Gallery();

$dom->load("gallery.xml");

$dom->addPhoto($category,$intro,$object,$description,$tmb,$upload_image);

$dom->save("gallery.xml");

 

?>

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.