BertaEditor::updateImageCacheForSection($sectionsList[$sName]); BertaEditor::saveSections($sectionsList); } else { if ($decoded['property'] == 'galleryImageCaption') { // image / video caption $sectionsList = BertaEditor::getSections(); $sName = $decoded['section']; $imageCache =& $sectionsList[$sName]['mediaCacheData']['file']; Array_XML::makeListIfNotList($imageCache); foreach ($imageCache as $cacheIndex => $im) { if ($im['@attributes']['src'] == $decoded['params']) { $imageCache[$cacheIndex]['value'] = $decoded['value']; break; } } BertaEditor::updateImageCacheForSection($sectionsList[$sName]); BertaEditor::saveSections($sectionsList); } else { if ($decoded['action'] == 'SET_AUTOPLAY') { $sectionsList = BertaEditor::getSections(); $sName = $decoded['section']; if (empty($sectionsList[$sName]['mediaCacheData']['@attributes'])) { $sectionsList[$sName]['mediaCacheData']['@attributes'] = array(); } if (preg_match('/^\\d+$/', $decoded['params'])) { if (preg_match('/^[0]+.[1-9]+/', $decoded['params'])) { $decoded['params'] = preg_replace('/^[0]+/', '', $decoded['params']); } $sectionsList[$sName]['mediaCacheData']['@attributes']['autoplay'] = $decoded['params']; } else { $sectionsList[$sName]['mediaCacheData']['@attributes']['autoplay'] = 0;
$imInfo[0] = round($imInfo[0] / 2); $imInfo[1] = round($imInfo[1] / 2); BertaGallery::getResizedSrc($fileFolder, $fName, $imInfo[0], $imInfo[1]); $settings->update($settingsProperty[0], $settingsProperty[1], $fName); $settings->update($settingsProperty[0], $settingsProperty[1] . '_width', $imInfo[0]); $settings->update($settingsProperty[0], $settingsProperty[1] . '_height', $imInfo[1]); $settings->save(); } elseif ($sectionBackground) { $sectionsToEdit = BertaEditor::getSections(); if (empty($sectionsToEdit[$sectionName]['mediafolder'])) { $sectionsToEdit[$sectionName]['mediafolder'] = array(); } if (empty($sectionsToEdit[$sectionName]['mediafolder']['value'])) { $sectionsToEdit[$sectionName]['mediafolder']['value'] = $mediaFolder; } BertaEditor::updateImageCacheForSection($sectionsToEdit[$sectionName]); BertaEditor::saveSections($sectionsToEdit); } else { // update image cache $blog = BertaEditor::loadBlog($sectionName); BertaEditor::updateImageCacheFor($blog, $entryId); BertaEditor::saveBlog($sectionName, $blog); } // write response $result['status'] = 1; $result['hash'] = md5_file($fileFolder . $fName); $result['type'] = $fileType; // image $result['smallthumb_path'] = $smallThumbPath; $result['smallthumb_width'] = $smallThumbInfo[0]; $result['smallthumb_height'] = $smallThumbInfo[1];