@rename($path . $decoded['value'], $path . $newFileName); if (!isset($e['mediaCacheData']['file']['value']) && count($e['mediaCacheData']['file']) > 1) { foreach ($e['mediaCacheData']['file'] as $cacheIndex => $im) { if ($im['@attributes']['src'] == $decoded['value']) { $e['mediaCacheData']['file'][$cacheIndex]['@attributes']['src'] = $newFileName; $e['mediaCacheData']['file'][$cacheIndex]['@attributes']['width'] = $crop['w']; $e['mediaCacheData']['file'][$cacheIndex]['@attributes']['height'] = $crop['h']; break; } } } else { $e['mediaCacheData']['file']['@attributes']['src'] = $newFileName; $e['mediaCacheData']['file']['@attributes']['width'] = $crop['w']; $e['mediaCacheData']['file']['@attributes']['height'] = $crop['h']; } $smallThumb = BertaEditor::images_getSmallThumbFor($path . $newFileName); $returnUpdate = $newFileName; $returnParams = array('path' => $path, 'smallThumb' => $smallThumb); } elseif ($decoded['action'] != 'SAVE') { switch ($decoded['action']) { case 'DELETE_ENTRY': if (!BertaEditor::deleteEntry($decoded['value'], $blog)) { $returnError = 'entry cannot be deleted! check permissions.'; } BertaEditor::updateImageCacheFor($blog); BertaEditor::updateSectionEntryCount($decoded['section'], $blog); BertaEditor::populateTags($decoded['section'], $blog); break; case 'SET_GALLERY_TYPE': if (empty($e['mediaCacheData']['@attributes'])) { $e['mediaCacheData']['@attributes'] = array();
echo '<li class="video" filename="' . (string) $im['@attributes']['src'] . '" fileinfo="' . '' . '">'; echo '<div class="placeholderContainer" style="background-image: ' . ($imageThumbSrc ? ('url(' . $imageThumbSrc . '?no_cache=' . rand() . ')') : 'none') . '; width: ' . $imageWidth . ';"><div class="placeholder"></div></div>'; echo '<span class="grabHandle xMAlign-container"><span class="xMAlign-outer"><a class="xMAlign-inner" title="click and drag to move"><span></span></a></span></span>'; echo '<a href="#" class="delete"></a>'; echo '<div class="dimsForm">' . '<div class="posterContainer"></div><a class="poster" href="#">' . ($imageThumbSrc ? 'change' : 'upload') . ' poster frame</a>' . /*'<span class="dim" property="width" x_params="' . $im['value'] . '">' . (!empty($im['@attributes']['width']) ? $im['@attributes']['width'] : BertaEditor::getXEmpty('width')) . '</span> x ' . '<span class="dim" property="height" x_params="' . $im['value'] . '">' . (!empty($im['@attributes']['height']) ? $im['@attributes']['height'] : BertaEditor::getXEmpty('height')) . '</span>' . */ '</div>'; echo '<div class="xEGEImageCaption ' . $xEditSelectorMCESimple . ' xProperty-galleryImageCaption xCaption-caption xParam-' . $im['@attributes']['src'] . '">', !empty($im['value']) ? $im['value'] : '', '</div>'; echo '</li>'; echo "\n"; } else { $imSrc = $options['MEDIA_ROOT'] . $entry['mediafolder']['value'] . '/' . (string) $im['@attributes']['src']; $imageThumbSrc = BertaEditor::images_getSmallThumbFor($imSrc); if($imageThumbSrc) { echo '<li filename="' . (string) $im['@attributes']['src'] . '" fileinfo="' . '' . '">'; echo '<img class="img" src="' . $imageThumbSrc . '" />'; echo '<span class="grabHandle xMAlign-container"><span class="xMAlign-outer"><a class="xMAlign-inner" title="click and drag to move"><span></span></a></span></span>'; echo '<a href="#" class="delete"></a>'; echo '<div class="xEGEImageCaption ' . $xEditSelectorMCESimple . ' xProperty-galleryImageCaption xCaption-caption xParam-' . $im['@attributes']['src'] . '">', !empty($im['value']) ? $im['value'] : '', '</div>'; echo '</li>'; } } } } else { //echo '<li class="placeholder"><img src="' . $ENGINE_ROOT . 'layout/gallery-placeholder.gif" /></li>'; }
$result['size'] = $_FILES['Filedata']['size']; $result['width'] = null; $result['height'] = null; } else { //$fTempName = uniqid('__temp_'); //copy($fileFolder . $fName, $fileFolder . $fTempName); //error_log(print_r($constraints, true), 3, dirname(__FILE__) . "/my-errors.log"); $resampleOk = TRUE; //BertaEditor::images_resampleIfNeeded($fileFolder . $fTempName, $constraints, $imInfo[0], $imInfo[1]); // if image could not be resampled, it is not a valid image if ($resampleOk) { //$origVersionPath = $bSaveOriginal ? BertaEditor::images_getOrigVersionFor($fileFolder . $fName, $constraints['max_orig_width'], $constraints['max_orig_height'], true) : ''; //unlink($fileFolder . $fName); //rename($fileFolder . $fTempName, $fileFolder . $fName); // create the small thumb $smallThumbPath = BertaEditor::images_getSmallThumbFor($fileFolder . $fName); $smallThumbInfo = getimagesize($smallThumbPath); // if uploaded for background, create lighter image & create an image for grid if ($sectionBackground) { $bgImagePath = BertaEditor::images_getBgImageFor($fileFolder . $fName); $bgImageInfo = getimagesize($bgImagePath); $gridImageSrc = BertaGallery::images_getGridImageFor($fileFolder . $fName); if ($gridImageSrc) { $gridImageInfo = getimagesize($fileFolder . $gridImageSrc); } } if ($settingsProperty) { // update setings value if ($settings->get($settingsProperty[0], $settingsProperty[1])) { $oldF = $settings->get($settingsProperty[0], $settingsProperty[1]); @unlink($fileFolder . $oldF);