To participate you must create an account on apostrophenow.org. If you have already done so, click Login.

Show
Ignore:
Timestamp:
08/08/10 12:18:34 (22 months ago)
Author:
tboutell
Message:

Merged the cropping branch back to trunk:

Cropping is now available in the media repository. Every time you select an image for use on the site you have the opportunity to crop it. The image size constraints of the slot are taken into account. This means that you can satisfy a given set of constraints by cropping a wide variety of images that would not have been eligible for selection before.

Crops of existing images appear in the database as separate aMediaItem objects but do not duplicate the original image file. This means that many crops of a single source image can exist without significant overhead.

The slug field of a cropped version of an image contains cropping parameters. When rendering the image, Symfony routes spot these and crop the original file as needed.

By approaching the problem this way we have avoided the need for code that takes advantage of the media repository's image selection capabilities to change in any way in order to take advantage of cropping.

The single-image-select behavior of Apostrophe has changed to accommodate the extra cropping step. Single select for PDFs and videos still uses the selectSingle partial because they cannot be cropped.

Thanks to Spike Broehm for his contributions to the cropping project.

Fixes #227

Location:
plugins/apostrophePlugin/trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • plugins/apostrophePlugin/trunk

  • plugins/apostrophePlugin/trunk/modules/aMedia/templates/indexSuccess.php

    r1914 r1917  
    77  $results = isset($results) ? $sf_data->getRaw('results') : null; 
    88?> 
    9 <?php use_helper('I18N') ?> 
     9<?php use_helper('I18N','jQuery') ?> 
    1010<?php slot('body_class') ?>a-media<?php end_slot() ?> 
    11  
    12 <?php use_helper('jQuery') ?> 
     11<?php $type = aMediaTools::getAttribute('type') ?> 
     12<?php $selecting = aMediaTools::isSelecting() ?> 
    1313 
    1414<div id="a-media-plugin"> 
     
    2020        <?php if (aMediaTools::isSelecting()): ?> 
    2121 
    22     <?php if (isset($label)): ?> 
    23       <h3><?php echo htmlspecialchars($label) ?> or <?php echo link_to(__("Cancel", null, 'apostrophe'), "aMedia/selectCancel", array("class"=>"a-btn a-cancel text-only")) ?></h3> 
     22    <?php if (($type === 'image') || (aMediaTools::isMultiple())): ?> 
     23      <?php include_component('aMedia', 'selectMultiple', array('limitSizes' => $limitSizes, 'label' => (isset($label)?$label:null))) ?> 
     24    <?php else: ?> 
     25      <?php include_component('aMedia', 'selectSingle', array('limitSizes' => $limitSizes, 'label' => (isset($label)?$label:null))) ?> 
    2426    <?php endif ?> 
    25  
    26     <?php include_partial('aMedia/describeConstraints') ?> 
    27  
    28           <?php if (aMediaTools::isMultiple()): ?> 
    29             <?php include_partial('aMedia/selectMultiple', array('limitSizes' => $limitSizes)) ?> 
    30           <?php else: ?> 
    31             <?php include_partial('aMedia/selectSingle', array('limitSizes' => $limitSizes)) ?> 
    32           <?php endif ?> 
    33  
    3427        <?php endif ?> 
    3528 
    36   <?php if (aMediaTools::userHasUploadPrivilege()): ?> 
    37  
    38    <ul class="a-controls a-media-controls"> 
    39      <?php $selecting = aMediaTools::isSelecting() ?> 
    40      <?php $type = aMediaTools::getAttribute('type') ?> 
    41  
    42      <?php if (!($selecting && $type && ($type !== 'image'))): ?> 
    43      <li><a href="<?php echo url_for("aMedia/uploadImages") ?>" class="a-btn icon a-add"><?php echo __('Add Images', null, 'apostrophe') ?></a></li> 
    44      <?php endif ?> 
    45  
    46      <?php if (!($selecting && $type && ($type !== 'video'))): ?> 
    47      <li><a href="<?php echo url_for("aMedia/newVideo") ?>" class="a-btn icon a-add"><?php echo __('Add Video', null, 'apostrophe') ?></a></li> 
    48      <?php endif ?> 
    49  
    50      <?php if (!($selecting && $type && ($type !== 'pdf'))): ?> 
    51      <li><a href="<?php echo url_for("aMedia/editPdf") ?>" class="a-btn icon a-add"><?php echo __('Add PDF', null, 'apostrophe') ?></a></li> 
    52      <?php endif ?> 
    53  
    54    </ul> 
    55  
    56   <?php endif ?> 
    5729</div> 
    5830 
     
    6032 
    6133<div class="a-media-library"> 
     34         
     35        <h3>Media Library</h3> 
     36         
     37        <?php include_partial('aMedia/describeConstraints', array('limitSizes' => $limitSizes)) ?> 
     38         
     39        <?php if (aMediaTools::userHasUploadPrivilege()): ?> 
     40   <ul class="a-controls a-media-controls"> 
     41 
     42     <?php if (!($selecting && $type && ($type !== 'image'))): ?> 
     43     <li><a href="<?php echo url_for("aMedia/uploadImages") ?>" class="a-btn icon big a-add"><?php echo __('Add Images', null, 'apostrophe') ?></a></li> 
     44     <?php endif ?> 
     45 
     46     <?php if (!($selecting && $type && ($type !== 'video'))): ?> 
     47     <li><a href="<?php echo url_for("aMedia/newVideo") ?>" class="a-btn icon big a-add"><?php echo __('Add Video', null, 'apostrophe') ?></a></li> 
     48     <?php endif ?> 
     49 
     50     <?php if (!($selecting && $type && ($type !== 'pdf'))): ?> 
     51     <li><a href="<?php echo url_for("aMedia/editPdf") ?>" class="a-btn icon big a-add"><?php echo __('Add PDF', null, 'apostrophe') ?></a></li> 
     52     <?php endif ?> 
     53   </ul> 
     54  <?php endif ?> 
     55         
    6256 <?php for ($n = 0; ($n < count($results)); $n += 2): ?> 
    6357   <div class="a-media-row">