echo filename without extention
-
I have this piece of script from an image gallery I’ve slightly modified
<textarea name="description[<?php echo $pid ?>]" style="width:100%; margin-top: 2px;" ><?php echo stripslashes($picture->description) ?><?php echo ($picture->filename)?></textarea>What it does, it echoes the name of the image in the textbox next to it, so it can be used as alt text or caption. The little problem is that it also echoes the file extension (.jpg). I’m sure there’s a way to only extract the filename, but the solutions I found so far were too complicated.
As a bonus, is there a way not to echo anything once there is a description? (Let’s say you hit save, the filename became the description for that picture, but as the page refreshes, the filename plus extention is also added if you hit save again.)
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘echo filename without extention’ is closed to new replies.