php - Codeigniter upload library get thumb file name
I can't find any documentation on this. I'm uploading images and using
$config['create_thumb'] = TRUE;
to create a thumb and preserve the original image.
Is there a way to get the file name of the thumb image?_thumb
is automatically added in the name for thumbnails but there's no function to extract the full name.
Answer
Solution:
There really is a much easier way of doing this:
Answer
Solution:
CodeIgniter not providing any functions to extract the thumbnail name. It will add _thumb in your filename. If you want to write a custom function to get thumbnail name then use this.
Input :
Output :
Hope this helps your. Thank you!!
Answer
Solution:
Calling function.
Output will look like:
Answer
Solution:
I think you should create a function to generate the thumb image, like this :
To call that function, firstly you have to upload your file, get the file name & call the function ->
$this->generateThumb($file_resp['file_name']);
In your uploaded file folder, there will be 2 images (the original image & the generated thumb image with _thumb suffix)
To get the file name, I used "if" condition to ensure that there is no any errors in generating the thumb image, and then I join the $fileName+"_thumb". I used this way because I've checked the
$this->image_lib
object but there is no any references to the file name of generated thumb image.EDITED :
Hope it helps :)