Initial import: Carteasy Shop (Dev-Stand)
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
//ini_set("memory_limit","1024M");
|
||||
//set_time_limit(60000);
|
||||
|
||||
include_once '../../libs/phImaginator/phImaginator.class.php';
|
||||
// database
|
||||
/*
|
||||
$connection=mysql_connect('localhost', 'root', '1234') or die ("Verbindungsversuch fehlgeschlagen");
|
||||
mysql_select_db('intelectra_shop__', $connection) or die("Konnte die Datenbank nicht waehlen.1");
|
||||
*/
|
||||
$connection=mysql_connect('localhost', 'int-db-sql-shop', 'Msc7t24?381L') or die ("Verbindungsversuch fehlgeschlagen");
|
||||
mysql_select_db('webshop-sql', $connection) or die("Konnte die Datenbank nicht waehlen.1");
|
||||
|
||||
$query = mysql_query("SELECT id FROM structure WHERE parent_id=357") or die("Anfrage nicht erfolgreich");
|
||||
$data = array();
|
||||
$s_ids = array();
|
||||
while($obj = mysql_fetch_object($query)) {
|
||||
$s_ids[] = $obj->id;
|
||||
}
|
||||
|
||||
$query = mysql_query("SELECT id FROM structure WHERE parent_id in (".implode(',',$s_ids).") and (image like '%pdf')") or die("Anfrage nicht erfolgreich");
|
||||
$data = array();
|
||||
while($obj = mysql_fetch_object($query)) {
|
||||
$sql = "select s.id, s.name, isa.item_id, files.file_name from structure s
|
||||
left join item_structure_assign isa on isa.structure_id=s.id
|
||||
left join item_files files on files.item_id=isa.item_id
|
||||
where files.type = 0 and s.id=".$obj->id.' limit 1';
|
||||
$query2 = mysql_query($sql) or die("Anfrage nicht erfolgreich");
|
||||
$image = '';
|
||||
$image_path = '';
|
||||
while($obj2 = mysql_fetch_object($query2)) {
|
||||
if ($obj2->file_name) {
|
||||
$image_path = "../../web/intelectra_shop/images/article/".$obj2->file_name;
|
||||
$targetFile = "../../web/intelectra_shop/images/structure/".$obj2->file_name;
|
||||
echo "$targetFile <br>";
|
||||
copy ($image_path,$targetFile);
|
||||
$imaginator = new phImaginator();
|
||||
$imaginator->add($targetFile);
|
||||
$imaginator->Resize_fitBoth(180, 180);
|
||||
$imaginator->save();
|
||||
$sql = "
|
||||
UPDATE structure
|
||||
SET
|
||||
image='".$obj2->file_name."'
|
||||
WHERE id=".$obj2->id."
|
||||
";
|
||||
//echo "<br>".$sql;
|
||||
mysql_query($sql);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user