php - "_" character and variable conflict in filename, save an image -
what i'm trying save few images (3) using function:
function save($filename, $image_type = imagetype_png, $compression = 7, $permissions = null){ if($image_type == imagetype_jpeg) imagejpeg($this->image, $filename, $compression); else if($image_type == imagetype_gif) imagegif($this->image, $filename); else if($image_type == imagetype_png) imagepng($this->image, $filename); if($permissions != null) chmod($filename, $permissions); }
but when save images under names images/".$user_id."_32x32.png
, images/".$user_id."_64x64.png
, images/".$user_id."_128x128.png
1 of them saved
i tried change "images/".$user_id.".32x32.png"
instead of images/".$user_id."_32x32.png
got saved
if save 1 of them images/".$user_id."_32x32.png
doesn't save, it's character "_"
problem? why?
ps. $user_id
integer
edit
tried without var images/_32x32.png
, saved 3 images... code here: http://pastebin.com/35wasb0h
try
"images/{$user_id}_32x32.png"
Comments
Post a Comment