Automatic Alt Attribute

Discussion in 'PHP' started by leftysgirl, Jul 7, 2014.

  1. #1
    Hi,

    On my CakePHP website there is a page that users can upload pictures of their home properties. When a user uploads their images, their own file names disappears and is replaced with some auto-generated numbers. It is really confusing to look at if you have lots of pictures to upload, like in this is example I have attached. I would like to be able have more alt attribute related words for a title instead of seeing picture 019898983..etc

    Can anyone point me in the right direction to what I need to do? I am a beginner, so be easy on me!

    Here is the code from the page that the files are uploaded to:




    <div class="AddPropertyGrid"> Upload Images of Property </div>
    <div class="propertyinptouterDologin">

    <div class="middleRgtPropertyNameContainerRight">

    <?php echo $form->file('images',array('name'=>'propertyImage[]','label'=>'',multiple=>'multiple','div'=>'','maxlengthPhoto'=>'100', 'size' => '34')); ?>
    </div>
    </div>
     

    Attached Files:

    • 75.jpg
      75.jpg
      File size:
      41.8 KB
      Views:
      78
    leftysgirl, Jul 7, 2014 IP
  2. AsHinE

    AsHinE Well-Known Member

    Messages:
    240
    Likes Received:
    8
    Best Answers:
    1
    Trophy Points:
    138
    #2
    I'm not a specialist in cakePHP, but in general you should store user filenames and display them. User filenames are sent to server, so it's possible to get them there. You should find a place where uploaded files are processed and add saving original filename there.
     
    AsHinE, Jul 8, 2014 IP
  3. Zbee

    Zbee Active Member

    Messages:
    9
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    91
    #3
    If I were a visitor to your website, I'd prefer if you'd let me rename the picture(s) after choosing which one(s) to upload.

    That'd solve your problem of having weird picture names, and the visitor's problem of having their pictures named oddly and having that show up on their page.

    But, if it were my site, I'd make the picture names be numbers that increment, and have a database like this. But, I love making and having databases, so maybe it's just me :3
    [​IMG]
    Create code for this database: //s.zbee.me/1x6
     
    Zbee, Jul 11, 2014 IP