[Isocial-svn] SF.net SVN: isocial: [232]
Status: Pre-Alpha
Brought to you by:
aguidrevitch
From: <fsn...@us...> - 2008-06-01 17:04:53
|
Revision: 232 http://isocial.svn.sourceforge.net/isocial/?rev=232&view=rev Author: fsnobody Date: 2008-06-01 10:05:00 -0700 (Sun, 01 Jun 2008) Log Message: ----------- fix Modified Paths: -------------- app/controllers/preview_controller.php app/models/photoapp_photo.php app/models/stored_file.php app/views/photoapp/album/edit_photo.tpl app/views/photoapp/album/uploaded.tpl app/views/photoapp/album/view.tpl config/routes.php Modified: app/controllers/preview_controller.php =================================================================== --- app/controllers/preview_controller.php 2008-06-01 16:39:58 UTC (rev 231) +++ app/controllers/preview_controller.php 2008-06-01 17:05:00 UTC (rev 232) @@ -9,10 +9,8 @@ function index () { @list($width, $height, $type) = explode('x', $this->params['size']); if ($width > 10 && $height > 10) { - //$filename = join(DS, $this->params['path']); - $this->params['path'] = str_replace("@", "/", $this->params['path']); - $file = AK_PUBLIC_DIR . "/images/uploaded/" . $this->params['path']; - + $filename = join(DS, $this->params['path']); + $file = AK_PUBLIC_DIR . DS . $filename; if (file_exists($file) && !is_dir($file)) { $data = $this->createJPEGPreview($file, $width, $height, $type); header("Content-Type: " . image_type_to_mime_type(IMAGETYPE_JPEG)); Modified: app/models/photoapp_photo.php =================================================================== --- app/models/photoapp_photo.php 2008-06-01 16:39:58 UTC (rev 231) +++ app/models/photoapp_photo.php 2008-06-01 17:05:00 UTC (rev 232) @@ -6,7 +6,7 @@ 'stored_file' => array('class_name' => 'StoredFile', 'primary_key_name' => 'base_file_id')); - function beforeDestroy() { + function afterDestroy() { /* $albums_cover = $this->album->find('all', array('conditions' => array("img = '" . $this->img . "'"))); if ($albums_cover) @@ -18,10 +18,11 @@ } */ + $this->stored_file->load(); - $this->stored_file->remove(); - return parent::beforeDestroy(); - + $this->stored_file->destroy(); + + return parent::afterDestroy(); } } Modified: app/models/stored_file.php =================================================================== --- app/models/stored_file.php 2008-06-01 16:39:58 UTC (rev 231) +++ app/models/stored_file.php 2008-06-01 17:05:00 UTC (rev 232) @@ -3,14 +3,6 @@ class StoredFile extends BaseFile { - function location () { - return $this->user_id . DS . $this->name; - } - - function preview () { - return $this->user_id . "@" . $this->name; - } - function path () { return "images" . DS . "uploaded" . DS . $this->user_id . DS; } @@ -26,13 +18,16 @@ } function remove () { - unlink(AK_PUBLIC_DIR . DS . $this->path() . DS . $this->name); + return unlink(AK_PUBLIC_DIR . DS . $this->path() . DS . $this->name); } function url () { return AK_ASSET_URL_PREFIX . $this->path() . $this->name; } + function beforeDestroy () { + return $this->remove(); + } } ?> Modified: app/views/photoapp/album/edit_photo.tpl =================================================================== --- app/views/photoapp/album/edit_photo.tpl 2008-06-01 16:39:58 UTC (rev 231) +++ app/views/photoapp/album/edit_photo.tpl 2008-06-01 17:05:00 UTC (rev 232) @@ -11,7 +11,7 @@ <div class="edit_container"> <div class="photo_comment"><? $photo->stored_file->load();?> - <div class="img_medium"><img src="/preview/index/620x500/<?= $photo->stored_file->preview() ?>" /></div> + <div class="img_medium"><img src="/preview/620x500/<?= $photo->stored_file->url() ?>" /></div> <div class="data_medium"> <div class="form_create_row"> Modified: app/views/photoapp/album/uploaded.tpl =================================================================== --- app/views/photoapp/album/uploaded.tpl 2008-06-01 16:39:58 UTC (rev 231) +++ app/views/photoapp/album/uploaded.tpl 2008-06-01 17:05:00 UTC (rev 232) @@ -17,7 +17,7 @@ {loop uploaded_photos} <div class="photo_comment"> <div class="img"><? $uploaded_photo->stored_file->load();?> - <img src="/preview/index/100x100/<?= $uploaded_photo->stored_file->preview() ?>" /> + <img src="/preview/100x100/<?= $uploaded_photo->stored_file->url() ?>" /> </div> <div class="data"> Modified: app/views/photoapp/album/view.tpl =================================================================== --- app/views/photoapp/album/view.tpl 2008-06-01 16:39:58 UTC (rev 231) +++ app/views/photoapp/album/view.tpl 2008-06-01 17:05:00 UTC (rev 232) @@ -17,7 +17,7 @@ {loop photos} <div class="photo_view"> <div class="img"><? $photo->stored_file->load() - ?><img src="/preview/index/100x100/<?= $photo->stored_file->preview() ?>" /><? + ?><img src="/preview/100x100/<?= $photo->stored_file->url() ?>" /><? ?></div> <div class="links"> <ul class="actions_list"> Modified: config/routes.php =================================================================== --- config/routes.php 2008-06-01 16:39:58 UTC (rev 231) +++ config/routes.php 2008-06-01 17:05:00 UTC (rev 232) @@ -8,7 +8,11 @@ $Map->connect('/groupapp/board/:action/:id', array('controller' => 'board', 'module' => 'groupapp')); $Map->connect('/groupapp/group/:action/:id', array('controller' => 'group', 'module' => 'groupapp')); $Map->connect('/photoapp/:controller/:action/:id', array('controller' => 'album', 'module' => 'photoapp')); -$Map->connect('/preview/:action/:size/:path',array('controller' => 'preview', 'action' => 'index') ); + +//$Map->connect('/preview/:action/:size/:path',array('controller' => 'preview', 'action' => 'index') ); +$Map->connect('/preview/:size/*path', array('controller' => 'preview', 'action' => 'index')); + + $Map->connect('/:controller/:action/:id', array('controller' => 'default', 'action' => 'index')); $Map->connect('/:controller/:action/:from/:id', array('controller' => 'message', 'action' => 'show')); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |