Closed (fixed)
Project:
Media API
Version:
5.x-5.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
10 Jan 2008 at 14:40 UTC
Updated:
25 Jan 2008 at 14:01 UTC
I have set the folders up, but the images all land i files/0 (including derivatives).
This is the import snippet:
$metadata=array('title'=>$clean_title, 'source'=>$clean_source);
if (!$media=media_item_create($filename)){
$dump.="...media_item_create failed".print_r($media,TRUE);
return false;
}
$der_list=media_derivatives_by_ext($media->ext);
foreach($der_list as $der_name){
$dump.="Creating derivative $der_name\n";
if ($name=media_derive($media->mid, $der_name, true,true,false)){
$dump.="$name\n";
}else{
$dump.="Failed...\n";
}
}
media_metadata_save($media->mid, $metadata);
db_query( "INSERT INTO {media_attachments} "
."(nid,mid,weight,caption,flags,visible) VALUES (%d,%d,%d,'%s',%d,%d)",
$nid, $media->mid, 0, $clean_title, 0, 1 );
(Where as usual $dump is my logging facility, which can safely be ignored.)
I'm not sure what's the problem here. Is it that $fid=0 is interpreted literally?
Comments
Comment #1
rhys commentedThe problem here is the variable changed when I rearranged the system.
If you change save the details for the media directory (via settings), you shouldn't keep having this problem.
Comment #2
Ibn al-Hazardous commentedSeems right.
Comment #3
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.