Vairable Question |
Hello
I have a function and its called delete. When i delete my file it deletes it from two places, image/cache and another the saved cached image displays like a&t_logo-100x100.jpg 100x100 means width and height. currently on this line $cached_image = FCPATH . 'image/cache/' . utf8_substr($path, 0, utf8_strrpos($path, '.')) . '-' . 100 . 'x' . 100 . '.' . $extension; I have to enter the width and height manually. I would like to be able to do this $width & $height replacing the manually entered width and height. $cached_image = FCPATH . 'image/cache/' . utf8_substr($path, 0, utf8_strrpos($path, '.')) . '-' . $width . 'x' . $height . '.' . $extension; How can I make it so when I enter in $width & $height variables that it would pick width and height up automatic. utf8 is a custom helper that's autoloaded PHP Code: <?php In stead of having the width and height in image name should I just have it normal a&t_logo.jpg That I can do what would your thoughts be on that?
There's only one rule - please don't tell anyone to go and read the manual. Sometimes the manual just SUCKS!
I don't understand why you're doing it this way if they are copies of the same image in different directories. Since they're DIFFERENT, the filename can be the same in both and you don't need to mess with that.
$image = 'some-image.png'; unlink('/path/to/regular/images/' . $image); unlink('/path/to/cached/images/' . $image); But to answer your question, can't you just use image functions to get the width/height of the image before you delete it? PHP Code: foreach ($path_post as $path) {
(04-15-2015, 07:53 AM)CroNiX Wrote: I don't understand why you're doing it this way if they are copies of the same image in different directories. Since they're DIFFERENT, the filename can be the same in both and you don't need to mess with that. I will look more into it. Thanks for pointing it out. All ways happy to learn.
There's only one rule - please don't tell anyone to go and read the manual. Sometimes the manual just SUCKS!
|
Welcome Guest, Not a member yet? Register Sign In |