Jump to content

[Модуль] редактирование фото


Recommended Posts

1 заходим в templates\Default\js открыть там файл profile.js
ищем

//PHOTO EDITOR
var photoeditor = {
        start: function(img, id, h){
                var height = parseInt(h) + 180;
                $('#ladybug_ant'+id).hide();
                $('#frameedito'+id).html('<iframe src="http://pixlr.com/express/?s=c&image='+escape(img)+'&title=photo&target='+escape('http://'+location.host+'/index.php?go=photo_editor&pid='+id)+'&exit='+escape('http://'+location.host+'/index.php?go=photo_editor&act=close&image='+img)+'" width="770" height="'+height+'" frameborder="0"></iframe>');
        }
}

заменить на

//PHOTO EDITOR
var photoeditor = {
        start: function(img, id, h, aid, uid){
                var height = parseInt(h) + 180;
            $('#ptpanel'+id).hide();
                $('#prpanel'+id).hide();
                $('#pprev'+id).hide();
                $('#ladybug_ant'+id).hide();
                $('#frameedito'+id).show();

        },
                close: function(img, id, h, aid, uid){
                var height = parseInt(h) + 180;
            //$('#prpanel'+id).show();
                //$('#ladybug_ant'+id).show();
//$('#frameedito'+id).hide();
        //$('#ladybug_ant'+id).load('<img id="ladybug_ant'+id+'" class="ladybug_ant" src="'+img+'" alt="" style="display: inline;">');
document.location.replace('/photo'+uid+'_'+id+'_'+aid);                                       
                                        //Page.Go('/photo'+uid+'_'+id+'_'+aid);

        },
       
        onreset: function(img, id, h, aid, uid){
                 var id = $('#pid').val();

    var img = $('#filteredPhotosave').val();


       
       
                $.post('/index.php?go=photo_editor&act=offsave', {id: id, img: img}, function(d){
                        Box.Info('inf', 'Информация', 'Изображение отредактировано');
                //$('#prpanel'+id).show();
                //$('#ladybug_ant'+id).show();
        //$('#frameedito'+id).hide();
                //$('#ladybug_ant'+id).load();

                });
                document.location.replace('/photo'+uid+'_'+id+'_'+aid);                                       

        }
       
}

2 заходим в templates\Default открыть файл photo_view.tpl
ищем

<a href="/photo{uid}_{next-id}{section}" onClick="[all]Photo.Show(this.href)[/all]

ниже ставим

<div id="frameedito{id}" style="display: none;">
   <script type="text/javascript">
   function savefilter(img, id, h, aid, uid){
        var id = $('#pid').val();
    var img = $('#filteredPhotosave').val();
        $.post('/index.php?go=photo_editor&act=save', {id: id, img: img}, function(d){
        Box.Info('inf', 'Информация', 'Изображение отредактировано');
        });
        document.location.replace('/photo'+uid+'_'+id+'_'+aid);                                       
    }
    </script>
    <input type="hidden" id="pid" value="{id}" />
    <section id="photoEffect">
        <figure>
        <img id="originalPhoto" src="{photo}" >
        </figure>
        <nav>
        <section id="filterButtons">
        <div id="reset" class="filter">
        <div class="filter-tag">Normal</div>
        </div>
        <div id="fluorescent" class="filter">
        <div class="filter-tag">Fluorescent</div>
                                </div>
                                <div id="nostalgia" class="filter">
                                        <div class="filter-tag">Nostalgia</div>
                                </div>
                                <div id="phykos" class="filter">
                                        <div class="filter-tag">Phykos</div>
                                </div>
                                <div id="lotus" class="filter">
                                        <div class="filter-tag">Lotus</div>
                                </div>
                                <div id="memphis" class="filter">
                                        <div class="filter-tag">Memphis</div>
                                </div>
                                <div id="deutlich" class="filter">
                                        <div class="filter-tag">Deutlich</div>
                                </div>
                                <div id="sumie" class="filter">
                                        <div class="filter-tag">Sumie</div>
                                </div>
                                <div id="rockstar" class="filter">
                                        <div class="filter-tag">Rock Star</div>
                                </div>
                                <div id="shine" class="filter">
                                        <div class="filter-tag">Shine</div>
                                </div>
                        </section>
                </nav>
                <div><div class="button_div fl_l" ><button onClick="savefilter('{photo}', '{id}', '{height}', '{aid}', '{uid}')">SAVE</button></div></div>
                <div><div class="button_div fl_l" ><button  onClick="photoeditor.close('{photo}', '{id}', '{height}', '{aid}', '{uid}'); return false">CLOSE</button></div></div>
<div><div class="button_div fl_l" ><button onClick="photoeditor.onreset('{photo}', '{id}', '{height}', '{aid}', '{uid}')">RESET</button></div></div>

        </section>
        <script src="../js/filterous.js"></script>
        <script src="../js/filterousEffects.js"></script>
        <script>
        (function() {
                var originalPhoto = document.getElementById('originalPhoto');
                document.getElementById('filterButtons').addEventListener('click', prepFilterEffect, false);
                function prepFilterEffect(e){
                        var filterButton = getFilterButton(e.target);
                        if(!filterButton) return;
                       
                        ApplyEffects[filterButton.id](originalPhoto, 'jpeg');

                }
                function getFilterButton(target) {
                        var button;
                        if(target.classList.contains('filter')) {
                                button = target;
                        } else if (target.parentNode.classList.contains('filter')) {
                                button = target.parentNode;
                        }
                        return button;
                }
                // Additional photo samples --
                var p1 = new Image();
                p1.src = '{photo}';
                var p2 = new Image();
                p1.src = 'macarons.jpg';
                var photos = {
                        aurora: 'Aurora Borealis',
                        bride: 'विवाह',
                        macarons: 'Colorful Macarons'
                };
                var caption = document.getElementById('caption');
                window.addEventListener('hashchange', function(e){
                        var hash = location.hash.substr(1);
                        originalPhoto.src = hash + '.jpg';       
                        caption.textContent = photos[hash];       
                        var prevFilteredPhotosave = document.getElementById('filteredPhotosave');
            var prevFilteredPhoto = document.getElementById('filteredPhoto');
                        if(prevFilteredPhotosave) {       
                                prevFilteredPhotosave.parentNode.removeChild(prevFilteredPhotosave);
                                originalPhoto.removeAttribute('hidden');
                        }
                        if(prevFilteredPhoto) {       
                                prevFilteredPhoto.parentNode.removeChild(prevFilteredPhoto);
                                originalPhoto.removeAttribute('hidden');
                        }
                }, false);
        })();
        </script>
        </div>
   </td>
   </div>
       
3 заходим в templates/Default/ открыть файл main.tpl
подключить туда

<link media="screen" href="{theme}/style/photofilter.css" type="text/css" rel="stylesheet" />


4 в заходим в templates\Default открыть файл photo_view.tpl
ищем

<a href="/photo{uid}_{next-id}{section}" onClick="[all]Photo.Show(this.href)[/all][wall]Photo.Close('{close-link}')[/wall]; return false" id="photo_href"><div class="photo_img_box">

в переди ставим вот такой тег

<td>

автора олег

требуется доработка

204811h80x441x1jq8z21x.png

[Модуль] редактирование фото.rar

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...