예제 #1
0
파일: index.php 프로젝트: fulldump/8
<?php

$id = '';
eval('$id=' . var_export($data['id'], true) . ';');
$edit = !in_array('noedit', $flags);
$image = ImageInstance::getByName($id);
if (null === $image) {
    $image = ImageInstance::INSERT();
    $image->setName($id);
}
$options = '';
if (array_key_exists('style', $data)) {
    $options = "/{$data['style']}";
}
$url = "/img/{$image->getImage()->getId()}{$options}";
if (in_array('background', $flags)) {
    if (array_key_exists('edit', $_GET) && Session::isLoggedIn() && $edit) {
        echo "<div style=\"background-image:url('{$url}')\" edit_id='{$id}' edit_options='{$options}' component='Image' class='background'></div>";
    } else {
        echo "<div style=\"background-image:url('{$url}')\" component='Image' class='background'></div>";
    }
} else {
    if (array_key_exists('edit', $_GET) && Session::isLoggedIn() && $edit) {
        echo "<img src='{$url}' alt='{$image->getDescription()}' edit_id='{$id}' edit_options='{$options}' component='Image' editable>";
    } else {
        echo "<img src='{$url}' alt='{$image->getDescription()}'>";
    }
}
예제 #2
0
파일: set_image.php 프로젝트: fulldump/8
<?php

$id_image_instance = $_POST['id_image_instance'];
$id_image = $_POST['id_image'];
if (Session::isLoggedIn()) {
    ImageInstance::getByName($id_image_instance)->setImage(Image::ROW($id_image));
}