mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-24 02:38:50 +02:00
Added Image files from old Part-DB.
This commit is contained in:
parent
b2e0e4b7ad
commit
2e3713cd5e
2090 changed files with 344 additions and 20 deletions
|
@ -46,6 +46,9 @@ class PartController extends AbstractController
|
|||
*/
|
||||
function show(Part $part)
|
||||
{
|
||||
$filename = $part->getMasterPictureFilename(true);
|
||||
dump($filename);
|
||||
|
||||
return $this->render('show_part_info.html.twig',
|
||||
[
|
||||
"part" => $part
|
||||
|
|
|
@ -108,13 +108,14 @@ class Attachment extends NamedDBElement
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the filename (absolute path from filesystem root, as a UNIX path [only slashes])
|
||||
* Get the filename, relative to %BASE%
|
||||
*
|
||||
* @return string the filename as an absolute UNIX filepath from filesystem root
|
||||
* @return string
|
||||
*/
|
||||
public function getFilename() : string
|
||||
{
|
||||
return str_replace('%BASE%', BASE, $this->filename);
|
||||
return $this->filename;
|
||||
//return str_replace('%BASE%', BASE, $this->filename);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -89,21 +89,12 @@ class Footprint extends PartsContainingDBElement
|
|||
|
||||
/**
|
||||
* Get the filename of the picture (absolute path from filesystem root)
|
||||
*
|
||||
* @param bool $absolute If set to true, then the absolute filename (from system root) is returned.
|
||||
* If set to false, then the path relative to Part-DB folder is returned.
|
||||
* @return string @li the absolute path to the picture (from filesystem root), as a UNIX path (with slashes)
|
||||
* @return string the saved filename in the DB
|
||||
* @li an empty string if there is no picture
|
||||
*/
|
||||
public function getFilename(bool $absolute = true) : string
|
||||
public function getFilename() : string
|
||||
{
|
||||
if ($absolute == true) {
|
||||
//TODO
|
||||
throw new \Exception("Not Implemented yet...");
|
||||
//return str_replace('%BASE%', BASE, $this->db_data['filename']);
|
||||
} else {
|
||||
return $this->filename;
|
||||
}
|
||||
return $this->filename;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -447,7 +447,7 @@ class Part extends AttachmentContainingDBElement
|
|||
*/
|
||||
public function getMasterPictureAttachement() : ?Attachment
|
||||
{
|
||||
return $this->master_picture_attachement;
|
||||
return $this->master_picture_attachment;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -670,19 +670,19 @@ class Part extends AttachmentContainingDBElement
|
|||
* @return string the whole path + filename from filesystem root as a UNIX path (with slashes)
|
||||
* @return NULL if there is no picture
|
||||
*
|
||||
* @throws Exception if there was an error
|
||||
* @throws \Exception if there was an error
|
||||
*/
|
||||
public function getMasterPictureFilename(bool $use_footprint_filename = false)
|
||||
public function getMasterPictureFilename(bool $use_footprint_filename = false) : ?string
|
||||
{
|
||||
$master_picture = $this->getMasterPictureAttachement(); // returns an Attachement-object
|
||||
|
||||
if (\is_object($master_picture)) {
|
||||
if ($master_picture !== null) {
|
||||
return $master_picture->getFilename();
|
||||
}
|
||||
|
||||
if ($use_footprint_filename) {
|
||||
$footprint = $this->getFootprint();
|
||||
if (\is_object($footprint)) {
|
||||
if ($footprint !== null) {
|
||||
return $footprint->getFilename();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue