mysql & binarie

Pagina: 1
Acties:

  • DjFoxy
  • Registratie: Oktober 2000
  • Laatst online: 15-11-2023
Ik ben bezig om een foto gallery te maken op mijn linux Redhat 7.3 systeem.
Dat ding word ook database aangestuurd.
In princiepe kan ik alles doen, categorien aanmaken ed, maar een foto uploaden dat lukt me niet.
Ik gebruik een script dat ik NIET zelf heb geschreven.
echter heb ik nog een ander galery script geprobeerd en daar heb ik het zelfde probleem mee.
De database accepteerd wel de tekst die bij de foto hoort, maar hij zet de foto niet op de plaats die daar voor is bedoeld !!!
Het script kan schrijven in de daarvoor bedoelde directories.
Hetzelfde script draait op een andere linuxcomputer van een internet bedrijf wel !!

Jaja de paprika


Verwijderd

een naam van het andere script zou handig zijn :) lijkt gewoon een fout van script / foute instelling bij jou omdat de andere wel werkt zul je het denk niet in mysql zelf moeten zoeken (met fout instellingen bedoel ik chmod etc en evt in het script zelf)

offtopic:
hoort dit niet in P&W?

  • a casema user
  • Registratie: Januari 2000
  • Laatst online: 21-05 15:56
het scripje heeft waarschijnlijk geen rechten om op die ene locatie wat neer te zetten.
offtopic:
hoort dit niet in P&W?
yupp :+

Taaaa taa taa taaaa taa taa ta taaataaaaa.


  • sebas
  • Registratie: April 2000
  • Laatst online: 16-12-2025
misschien draagt het posten van een stukje uit de code ook wel bij aan duidelijkheid?

Everyone complains of his memory, no one of his judgement.


  • DjFoxy
  • Registratie: Oktober 2000
  • Laatst online: 15-11-2023
tuurlijk wil ik wel een stuk script uploaden maar ik denk dat ik iets mis ofzo van een library.

ok bij deze het script

<?php


// ----------------------------------------------
// SAVE IMAGE DATA
// ----------------------------------------------
// saves the image information
function save_image($photo_id="")
{

global $photo_id;
global $title;
global $date;
global $details;
global $author;
global $location;
global $action;
global $publish;
global $filename;
global $cat_id;
global $keywords;
global $cfg_fullsizepics_url;
global $cfg_thumb_url;
global $cfg_fullsizepics_path;
global $cfg_site_home, $cfg_admin_home, $cfg_per_page, $cfg_max_cols, $is_admin, $cfg_thumb_width, $cfg_table_width, $cfg_thumb_path, $cfg_resize_gifs, $cfg_use_resampling;

if (empty($photo_id)) {
$sql = "INSERT INTO foto_data (title, date, details, author, location, publish, cat_id, keywords) " .
"VALUES ('$title', '$date', '$details', '$author', '$location', '$publish', '$cat_id', '$keywords')";
$addpic=mysql_query($sql);
$sql2 = "select last_insert_id() from foto_data";
$getid=mysql_query($sql2);
list($new_id) = mysql_fetch_row($getid);
mysql_free_result($getid);

// upload image data
IF (($filename!="none") || ($filename!="")) {
copy($filename,"$cfg_fullsizepics_path"."/"."$new_id".".gif");
$size = GetImageSize("$cfg_fullsizepics_path"."/"."$new_id".".gif");
IF ($size[2]=="2") {
$imagename="$new_id".".jpg";
} ELSEIF ($size[2]=="1") {
$imagename = "$new_id".".gif";
} ELSEIF ($size[2]=="3") {
$imagename = "$new_id".".png";
}
rename("$cfg_fullsizepics_path"."/"."$new_id".".gif", "$cfg_fullsizepics_path"."/"."$imagename");
$sql3 = "UPDATE foto_data SET filename = '$imagename' WHERE id = '$new_id'";
$addimage=mysql_query($sql3);
// print "$sql3<br>";
unlink($filename);

$sql2 = "select filename from foto_data where id='$new_id'";
$getid=mysql_query($sql2);
list($photo_filename) = mysql_fetch_row($getid);
mysql_free_result($getid);


$image_stats = GetImageSize($cfg_fullsizepics_path."/".$photo_filename);
$imagewidth = $image_stats[0];
$imageheight = $image_stats[1];
$img_type = $image_stats[2];
$new_w = $cfg_thumb_width;
$ratio = ($imagewidth / $cfg_thumb_width);
$new_h = round($imageheight / $ratio);

// if the page is designated admin, AND the thumbnail does not already exist, start the dynamic thumbnailing routines

/* ------------------------------------------------------------------------------------------------
/* ------------------------------------------------------------------------------------------------
*/

if (($is_admin=="1") && (!file_exists($cfg_thumb_path."/".$photo_filename))) {
// if image is a jpeg, copy it as a jpeg
if ($img_type=="2") {
// dynamic thumbnailing
$src_img = imagecreatefromjpeg($cfg_fullsizepics_path."/".$photo_filename);
$dst_img = imagecreate($new_w,$new_h);
imagecopyresized($dst_img,$src_img,0,0,0,0,$new_w,$new_h,imagesx($src_img),imagesy($src_img));
imagejpeg($dst_img, "$cfg_thumb_path"."/$photo_filename");

// if image is a png, copy it as a png
} elseif ($img_type=="3") {
// print "png! ";
$dst_img=ImageCreate($new_w,$new_h);
$src_img=ImageCreateFrompng($cfg_fullsizepics_path."/".$photo_filename); ImageCopyResized($dst_img,$src_img,0,0,0,0,$new_w,$new_h,ImageSX($src_img),ImageSY($src_img));
Imagepng($dst_img, "$cfg_thumb_path"."/$photo_filename");

// if image is neither png nor jpeg (ie, invalid image or a gif file), use the fullsize as the thumbnail
} elseif ($img_type=="1") {
// if you have set the config to use gif resizing, copy thumbnail gif
if ($cfg_resize_gifs=="1") {
$dst_img=ImageCreate($new_w,$new_h);
$src_img=ImageCreateFromGif($cfg_fullsizepics_path."/".$photo_filename);
ImageCopyResized($dst_img,$src_img,0,0,0,0,$new_w,$new_h,ImageSX($src_img),ImageSY($src_img));
ImageGif($dst_img, "$cfg_thumb_path"."/$photo_filename");
print "grr!!";
} else {
$cfg_thumb_url=$cfg_fullsizepics_url;
}
} else {
$cfg_thumb_url=$cfg_fullsizepics_url;
} // end if resize_gif
} // end image_type
} // end is_admin


} elseif (!empty($photo_id)) {
$sql = "UPDATE foto_data SET title='$title', date='$date', details='$details', author='$author', location='$location', publish='$publish', keywords='$keywords' where id='$photo_id'";
mysql_query($sql);
// print "$sql";
}


// print "<br><br>$sql";
print "<p class=\"error\">Your image information has been saved in the database.</p>";
if (empty($photo_id)) {
print "<b>Your <a href=\"$cfg_fullsizepics_url/$imagename\" target=\"_new\">image</a> and <a href=\"$cfg_thumb_url/$imagename\" target=\"_new\">thumbnail</a> has been created.</b>";
}
show_me_the_images($cat_id);

}

?>

Jaja de paprika