Welcome Guest, Not a member yet? Register   Sign In
A solution to getting the name of the saved image when using the resize function in the CI Image library
#1

[eluser]Namsu[/eluser]
I opened a thread about this 1 or 2 days ago asking if I could get the file name of the re sized image. I have created a small solution to getting this if required.

Add a private variable at the top of the class Image_lib:

Code:
var $resname = "";

Look for the following two lines around 260-270:

Code:
$filename = $xp['name'];
$file_ext = $xp['ext'];

Then below add this line:

Code:
$this->resname = $filename.$this->thumb_marker.$file_ext;

Add a small function perhaps at the end of the file

Code:
function resizedName(){

        if ($this->resname != ""){

            return $this->resname;
        
        }

    }

After you resize your image you can call the added function to get the name:

Code:
$this->image_lib->resize();
$name = $this->image_lib->resizedName();

There are probably better ways but I required this for myself and just wanted to share a solution if anyone required it for this.




Theme © iAndrew 2016 - Forum software by © MyBB