views/image.php
Code: Select all
115 $Frame = Frame::find_one(array('EventId'=>$_REQUEST['eid'], 'FrameId'=>$_REQUEST['fid']));
116 if ( ! $Frame ) {
117 $previousBulkFrame = dbFetchOne(
118 'SELECT * FROM Frames WHERE EventId=? AND FrameId*100 < ? ORDER BY FrameID DESC LIMIT 1',
119 NULL, array($_REQUEST['eid'], $_REQUEST['fid'])
120 );
121 $nextBulkFrame = dbFetchOne(
122 'SELECT * FROM Frames WHERE EventId=? AND FrameId*100 > ? ORDER BY FrameID ASC LIMIT 1',
123 NULL, array($_REQUEST['eid'], $_REQUEST['fid'])
124 );
125 if ( $previousBulkFrame and $nextBulkFrame ) {
126 $Frame = new Frame($previousBulkFrame);
127 $Frame->FrameId($_REQUEST['fid']);
128
129 $percentage = ($Frame->FrameId() - $previousBulkFrame['FrameId']) / ($nextBulkFrame['FrameId'] - $previousBulkFrame['FrameId']);
130
131 $Frame->Delta($previousBulkFrame['Delta'] + floor( 100* ( $nextBulkFrame['Delta'] - $previousBulkFrame['Delta'] ) * $percentage )/100);
132 Logger::Debug("Got virtual frame from Bulk Frames previous delta: " . $previousBulkFrame['Delta'] . " + nextdelta:" . $nextBulkFrame['Delta'] . ' - ' . $previousBulkFrame ['Delta'] . ' * ' . $percentage );
133 } else {
134 Fatal('No Frame found for event('.$_REQUEST['eid'].') and frame id('.$_REQUEST['fid'].')');
135 }
136 }
137
138 # MYFIX1
139 $bulkFrame = (float)$Frame->FrameId() / 100;
140 $parts = explode('.', (string)$bulkFrame);
141 $frameIndex = $parts[1];
142 $bulkFrame = floor($bulkFrame);
143 $converted_frameId = $bulkFrame + $frameIndex;
144 #Warning($converted_frameId);
145
146 // Frame can be non-existent. We have Bulk frames. So now we should try to load the bulk frame
147 $path = $Event->Path().'/'.sprintf('%0'.ZM_EVENT_IMAGE_DIGITS.'d',$converted_frameId).'-'.$show.'.jpg';