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
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) {
$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
$db_art_path = '';
$upload_path = 'uploads/tracks/arts';
if ($is_same_src) {
$art_type = 'same';
$upload_full_path = $upload_path;
} else {
$art_type = 'other';
$upload_full_path = '/home/aseanvn/public_html/vmusicchart.dcv.vn/' . $upload_path;
}
......@@ -538,7 +540,7 @@ class CmsTrack extends CI_Controller
if ($this->upload->do_upload($track_image_field)) {
$upload_data = $this->upload->data();
$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;
}
......
......@@ -768,7 +768,7 @@ class MyHelper
*
* @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();
$default_image = base_url('images/track.png');
......@@ -776,7 +776,11 @@ class MyHelper
if ($is_same_src) {
$default_image = base_url(str_replace('%w', 200, $art));
} else {
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;
......
......@@ -110,9 +110,10 @@ class Track_model extends CI_Model
* @param $id
* @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_type', $art_type);
$this->db->where('id', $id);
$this->db->update($this->_table);
}
......
......@@ -22,7 +22,7 @@
<td style="text-align: center">
<?php echo MyHelper::getRankingCompare($data['track_id'], $data['ranking'], $previousRanking) ?>
</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">
<?php echo $data['name_song']; ?>
<br>
......
......@@ -17,7 +17,7 @@
<td style="text-align: center">
<?php echo MyHelper::getRankingCompare($data['track_id'], $data['order'], $previousRanking) ?>
</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">
<?php echo $data['name_song']; ?>
<br>
......
......@@ -17,7 +17,7 @@
<td style="text-align: center">
<?php echo MyHelper::getRankingCompare($data['track_id'], $data['order'], $previousRanking) ?>
</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">
<?php echo $data['name_song']; ?>
<br>
......
......@@ -16,7 +16,7 @@
<tr>
<td style="text-align: center"><?php echo ($key+1+$offset); ?></td>
<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 style="text-align: center"><?php echo $data['id']; ?></td>
<td style="text-align: left">
......
......@@ -48,7 +48,7 @@
<div class="profile-info-name">Ảnh</div>
<div class="profile-info-value">
<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">
</span>
</div>
......
......@@ -26,7 +26,7 @@
<div class="form-group">
<label class="col-lg-3">Ảnh hiện tại</label>
<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 class="form-group">
......
......@@ -44,7 +44,7 @@
<?php foreach ($update_singer_list as $key => $track): ?>
<tr>
<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']; ?>">
<?php echo MyHelper::truncate($track['title']); ?>
<br>
......@@ -95,7 +95,7 @@
<?php foreach ($update_composer_list as $key => $track): ?>
<tr>
<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']; ?>">
<?php echo MyHelper::truncate($track['title']); ?>
<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