SitePoint Sponsor |
|
User Tag List
Results 1 to 3 of 3
-
Sep 21, 2001, 06:40 #1
- Join Date
- Sep 2001
- Posts
- 2
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
DJPEG, CJPEG and PNMSCALE alternatives??
Hi all!
My web host does'nt seem to support the DJPEG, CJPEG and PNMSCALE utils..I'm told that I can use GD library instead. Now, the prob is I an NEW to PHP and have no idea how to write the following "un-supported" lines with GD "alteratives". Could someone PLEASE PLEASE help?
$x = 100;
$y = 150;
$tmp_tmb = "/tmp/$newname.tmb";
$command = "djpeg -pnm $filename | pnmscale -xsize $x -ysize $y | cjpeg > $tmp_tmb";
system($command);
echo $tmp_tmb;
-
Sep 21, 2001, 12:15 #2
Does your code resize an image and print it to the browser?
If it does see this:
http://www.sitepointforums.com/showt...threadid=33888
SeanHarry Potter
-- You lived inside my world so softly
-- Protected only by the kindness of your nature
-
Sep 21, 2001, 14:03 #3
- Join Date
- Sep 2001
- Posts
- 2
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
here's my code
it doesn't work:
function copy_file($filename,$newname, $orientation)
{
global $dir_arq;
global $dir_thumb;
$file = basename($filename);
$tmp_upload_path = "/tmp/";
$new_file_name = $dir_arq . $newname;
$new_thumb_name = $dir_thumb . $newname;
$size = GetImageSize($filename);
$width = $size[0];
$height = $size[1];
if ($orientation == 0 )
{
//Landscape
$x = 150;
$y = 100;
}
else
{
//portrait
$x = 100;
$y = 150;
}
$src = ImageCreateFromJpeg($filename);
$dst = ImageCreate($x,$y);
ImageCopyResized($dst, $src, 0, 0, 0, 0,$x,$y,$width,$height);
ImageJpeg($dst, $new_file_name, 1);
if ( copy($src, $new_file_name) )
{
echo "copied to archive folder!";
if ( copy($dst, $new_thumb_name) )
{
echo "copied to thumbnail folder";
return true;
}
else
{
echo "<script> alert('Error copying to thumbnails folder!');document.location.href=\"index.php?SID=$SID\" ;</script>";
}
}
else
{
echo "<script> alert('Error copying to archives folder!');document.location.href=\"index.php?SID=$SID\" ;</script>";
}
return false;
}
ImageDestroy($src);
ImageDestroy($dst);
if ( $img == "ok" )
{
$sql = "INSERT INTO images (img_description, img_date, img_format, FK_cat_id, FK_phot_id, img_name, img_orientation, img_photographer, img_caption) VALUES ('$description', '$gbl_date','$File_type', '$category', '1', '$File_name', '$orientation', '$photographer', '$caption')";
mysql_query( $sql );
$idget = mysql_insert_id();
//imagem
copy_file($File, $idget, $orientation );
echo "<script> alert('Inserted picture successfully!');document.location.href=\"index.php?SID=$SID\" ;</script>";
}
I'v even asked my friend to post thins one in the php-list yahoo groups and still no luck :-(
Bookmarks