-=Album date question=-

pedro666
pedro666's picture

Joined: 2005-10-11
Posts: 12
Posted: Wed, 2006-11-22 15:09

Hi gallery users,

I got backup of many albums on a DVD and I import it in my Gallery. Once all those albums have been import in my gallery I realise the Album Date and Time are the date of the import not the date of the folder(Album name). Is it possible to import automaticaly whit the date of the folder not the date the importation? I don't want to change for each album the date to got the right one :|.

I hope someone can help me :)

Thanks

-=Pedro=-

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Wed, 2006-11-22 19:17

you'd have to modify some code in g2.

for g2.1.2, edit modules/core/ItemAddFromServer.inc
for g2.2, edit modules/itemadd/ItemAddFromServer.inc

in the function _addItem, you'll need to stat() the $file to get the file creation time.
then after creating the file, you can do $item->setCreationTimestamp(...)

note that if your images have exif data with data, g2 could automatically read the correct date from there.

 
pedro666
pedro666's picture

Joined: 2005-10-11
Posts: 12
Posted: Wed, 2006-11-22 22:02

Hi

I a got this version g2.1.2, edit modules/core/ItemAddFromServer.inc
I paste you the function if you want help me to do the correction I will be very appreciated! ;)
Is it just in this function I have to do correction ?

function addItem($parentId, $file, $useSymlink, $textFields, &$status, &$error) {
$fileName = basename($file);
list ($base, $extension) = GalleryUtilities::getFileNameComponents($fileName);
list ($ret, $mimeType) = GalleryCoreApi::convertExtensionToMime($extension);
if ($ret) {
return $ret->wrap(__FILE__, __LINE__);
}
$base = GalleryCoreApi::convertToUtf8($base);
GalleryUtilities::sanitizeInputValues($base);

$title = ($textFields['title']) ? $base : '';
$summary = ($textFields['summary']) ? $base : '';
$description = ($textFields['description']) ? $base : '';

list ($ret, $newItem) = GalleryCoreApi::addItemToAlbum($file,
$fileName,
$title,
$summary,
$description,
$mimeType,
$parentId,
$useSymlink);
if ($ret) {
return $ret->wrap(__FILE__, __LINE__);
}

$status['addedFiles'][] = array('fileName' => GalleryCoreApi::convertToUtf8($fileName),
'id' => $newItem->getId(),
'warnings' => array());

return null;
}

Thanks so mutch!

-=Pedro=-

 
pedro666
pedro666's picture

Joined: 2005-10-11
Posts: 12
Posted: Tue, 2006-11-28 13:41

Hi

Somebody can just help me to correct the code I got some problem

Thanks

-=Pedro=-

 
pedro666
pedro666's picture

Joined: 2005-10-11
Posts: 12
Posted: Sat, 2006-11-25 05:18

-=Pedro=-