Commit c426e26b by Phạm Văn Đoan

fixbug lỗi ko up được sang src khác

parent 0e11d866
...@@ -413,7 +413,7 @@ class CmsTrack extends CI_Controller ...@@ -413,7 +413,7 @@ class CmsTrack extends CI_Controller
redirect(base_url('backend/cmsTrack/showTrack/'.$track_id)); redirect(base_url('backend/cmsTrack/showTrack/'.$track_id));
} }
$update = $this->privateUpdateTrackArt($track_id, 'track_image', false); $update = $this->privateUpdateTrackArt($track_id, 'track_image', true);
if ($update) { if ($update) {
$this->session->set_flashdata('success', 'Cập nhật ảnh bài hát thành công'); $this->session->set_flashdata('success', 'Cập nhật ảnh bài hát thành công');
...@@ -521,8 +521,10 @@ class CmsTrack extends CI_Controller ...@@ -521,8 +521,10 @@ class CmsTrack extends CI_Controller
$db_art_path = ''; $db_art_path = '';
$upload_path = 'uploads/tracks/arts'; $upload_path = 'uploads/tracks/arts';
if ($is_same_src) { if ($is_same_src) {
$art_type = 'same';
$upload_full_path = $upload_path; $upload_full_path = $upload_path;
} else { } else {
$art_type = 'other';
$upload_full_path = '/home/aseanvn/public_html/vmusicchart.dcv.vn/' . $upload_path; $upload_full_path = '/home/aseanvn/public_html/vmusicchart.dcv.vn/' . $upload_path;
} }
...@@ -538,7 +540,7 @@ class CmsTrack extends CI_Controller ...@@ -538,7 +540,7 @@ class CmsTrack extends CI_Controller
if ($this->upload->do_upload($track_image_field)) { if ($this->upload->do_upload($track_image_field)) {
$upload_data = $this->upload->data(); $upload_data = $this->upload->data();
$db_art_path = $upload_path . '/' . $upload_data['file_name']; $db_art_path = $upload_path . '/' . $upload_data['file_name'];
$this->track_model->update_art($track_id, $db_art_path); $this->track_model->update_art($track_id, $db_art_path, $art_type);
return true; return true;
} }
......
...@@ -768,7 +768,7 @@ class MyHelper ...@@ -768,7 +768,7 @@ class MyHelper
* *
* @return string * @return string
*/ */
public static function getArtByTrack($art, $is_same_src=false) public static function getArtByTrack($art, $is_same_src=false, $art_type='other')
{ {
$CI = &get_instance(); $CI = &get_instance();
$default_image = base_url('images/track.png'); $default_image = base_url('images/track.png');
...@@ -776,7 +776,11 @@ class MyHelper ...@@ -776,7 +776,11 @@ class MyHelper
if ($is_same_src) { if ($is_same_src) {
$default_image = base_url(str_replace('%w', 200, $art)); $default_image = base_url(str_replace('%w', 200, $art));
} else { } else {
$default_image = $CI->config->item('vmusicchart_url') . str_replace('%w', 200, $art); if ($art_type === 'other') {
$default_image = $CI->config->item('vmusicchart_url') . str_replace('%w', 200, $art);
} else {
$default_image = base_url(str_replace('%w', 200, $art));
}
} }
} }
return $default_image; return $default_image;
......
...@@ -110,9 +110,10 @@ class Track_model extends CI_Model ...@@ -110,9 +110,10 @@ class Track_model extends CI_Model
* @param $id * @param $id
* @param $art_path * @param $art_path
*/ */
public function update_art($id, $art_path) public function update_art($id, $art_path, $art_type='same')
{ {
$this->db->set('art', $art_path); $this->db->set('art', $art_path);
$this->db->set('art_type', $art_type);
$this->db->where('id', $id); $this->db->where('id', $id);
$this->db->update($this->_table); $this->db->update($this->_table);
} }
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
<td style="text-align: center"> <td style="text-align: center">
<?php echo MyHelper::getRankingCompare($data['track_id'], $data['ranking'], $previousRanking) ?> <?php echo MyHelper::getRankingCompare($data['track_id'], $data['ranking'], $previousRanking) ?>
</td> </td>
<td style="text-align: center"><img src="<?php echo MyHelper::getArtByTrack($data['art']); ?>" style="max-width: 50px; max-height: 50px"></td> <td style="text-align: center"><img src="<?php echo MyHelper::getArtByTrack($data['art'], false, $data['art_type']); ?>" style="max-width: 50px; max-height: 50px"></td>
<td style="text-align: left"> <td style="text-align: left">
<?php echo $data['name_song']; ?> <?php echo $data['name_song']; ?>
<br> <br>
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
<td style="text-align: center"> <td style="text-align: center">
<?php echo MyHelper::getRankingCompare($data['track_id'], $data['order'], $previousRanking) ?> <?php echo MyHelper::getRankingCompare($data['track_id'], $data['order'], $previousRanking) ?>
</td> </td>
<td style="text-align: center"><img style="max-width: 50px" src="<?php echo MyHelper::getArtByTrack($data['art']); ?>"></td> <td style="text-align: center"><img style="max-width: 50px" src="<?php echo MyHelper::getArtByTrack($data['art'], false, $data['art_type']); ?>"></td>
<td style="text-align: left"> <td style="text-align: left">
<?php echo $data['name_song']; ?> <?php echo $data['name_song']; ?>
<br> <br>
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
<td style="text-align: center"> <td style="text-align: center">
<?php echo MyHelper::getRankingCompare($data['track_id'], $data['order'], $previousRanking) ?> <?php echo MyHelper::getRankingCompare($data['track_id'], $data['order'], $previousRanking) ?>
</td> </td>
<td style="text-align: center"><img style="max-width: 50px" src="<?php echo MyHelper::getArtByTrack($data['art']); ?>"></td> <td style="text-align: center"><img style="max-width: 50px" src="<?php echo MyHelper::getArtByTrack($data['art'], false, $data['art_type']); ?>"></td>
<td style="text-align: left"> <td style="text-align: left">
<?php echo $data['name_song']; ?> <?php echo $data['name_song']; ?>
<br> <br>
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
<tr> <tr>
<td style="text-align: center"><?php echo ($key+1+$offset); ?></td> <td style="text-align: center"><?php echo ($key+1+$offset); ?></td>
<td style="text-align: center"> <td style="text-align: center">
<img style="max-width: 50px" src="<?php echo MyHelper::getArtByTrack($data['art']) ?>"> <img style="max-width: 50px" src="<?php echo MyHelper::getArtByTrack($data['art'], false, $data['art_type']) ?>">
</td> </td>
<td style="text-align: center"><?php echo $data['id']; ?></td> <td style="text-align: center"><?php echo $data['id']; ?></td>
<td style="text-align: left"> <td style="text-align: left">
......
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
<div class="profile-info-name">Ảnh</div> <div class="profile-info-name">Ảnh</div>
<div class="profile-info-value"> <div class="profile-info-value">
<span> <span>
<img src="<?php echo MyHelper::getArtByTrack($track[0]['art'], false) ?>" <img src="<?php echo MyHelper::getArtByTrack($track[0]['art'], false, $track[0]['art_type']) ?>"
style="max-width: 200px; max-height: 200px"> style="max-width: 200px; max-height: 200px">
</span> </span>
</div> </div>
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
<div class="form-group"> <div class="form-group">
<label class="col-lg-3">Ảnh hiện tại</label> <label class="col-lg-3">Ảnh hiện tại</label>
<div class="col-lg-3"> <div class="col-lg-3">
<img src="<?php echo MyHelper::getArtByTrack($track[0]['art'], false) ?>" style="max-width: 200px; max-height: 200px"> <img src="<?php echo MyHelper::getArtByTrack($track[0]['art'], false, $track[0]['art_type']) ?>" style="max-width: 200px; max-height: 200px">
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
......
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
<?php foreach ($update_singer_list as $key => $track): ?> <?php foreach ($update_singer_list as $key => $track): ?>
<tr> <tr>
<td style="text-align: center"><?php echo ($key+1); ?></td> <td style="text-align: center"><?php echo ($key+1); ?></td>
<td style="text-align: center"><img style="max-width: 50px" src="<?php echo MyHelper::getArtByTrack($track['art']); ?>"></td> <td style="text-align: center"><img style="max-width: 50px" src="<?php echo MyHelper::getArtByTrack($track['art'], false, $track['art_type']); ?>"></td>
<td style="text-align: left" title="<?php echo $track['title']; ?>"> <td style="text-align: left" title="<?php echo $track['title']; ?>">
<?php echo MyHelper::truncate($track['title']); ?> <?php echo MyHelper::truncate($track['title']); ?>
<br> <br>
...@@ -95,7 +95,7 @@ ...@@ -95,7 +95,7 @@
<?php foreach ($update_composer_list as $key => $track): ?> <?php foreach ($update_composer_list as $key => $track): ?>
<tr> <tr>
<td style="text-align: center"><?php echo ($key+1); ?></td> <td style="text-align: center"><?php echo ($key+1); ?></td>
<td style="text-align: center"><img style="max-width: 50px" src="<?php echo MyHelper::getArtByTrack($track['art']); ?>"></td> <td style="text-align: center"><img style="max-width: 50px" src="<?php echo MyHelper::getArtByTrack($track['art'], false, $track['art_type']); ?>"></td>
<td style="text-align: left" title="<?php echo $track['title']; ?>"> <td style="text-align: left" title="<?php echo $track['title']; ?>">
<?php echo MyHelper::truncate($track['title']); ?> <?php echo MyHelper::truncate($track['title']); ?>
<br> <br>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment