php - Laravel delete original image and retina version -


i'm trying make retina ready design, when upload image it's uploading 1 original name , low quality , 1 high quality added @2x end of name. question how delete both of them have original name extension? here tried:

$destination_path   = public_path() . 'storage/cover_photos/';  $old_cover = $destination_path . $this->cover_name; $old_cover_retina = $destination_path . $old_cover->getclientoriginalname() . '@2x' . $this->old_cover->getclientoriginalextension(); 

$this->cover_name returns name of image in string "name.jpg".

i'm getting error:

call member function getclientoriginalname() on non-object 

am need convert $old_cover object or there way?

you can use pathinfo() details particular file, including filename , extension. should able this:

$fileinfo = pathinfo($destination_path . $this->cover_name); $old_cover_retina = $destination_path . $fileinfo['filename'] . '@2x' . $fileinfo['extension']; 

Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

order - Notification for user in user account opencart -