Results 1 to 3 of 3

Thread: TABLE `images` change `name`

  1. #1

    Default TABLE `images` change `name`

    Hello Yab, could you please help to change data base string:

    For example image in DB is saved like
    Code:
    (5553, 'c/e/a/f/f773a53b.png', 'Picture 3.png', 0, 463, 356, 246939, '78.153.129.12', 'e2520f97bf2a5ab78b412476aa1bfadd', 1212002475, 1533, '246939', 1295464740, 1, 0, 0, 0, 0, 'db00e6e69ce1', NULL, NULL, 0, NULL),
    where 'Picture 3.png' is original file name

    How to change it to Picture 3 and also if original image name has smth like: image-screenshot.jpg to make 'image screenshot' (with space)

  2. #2

    Default

    done

    Code:
    $ex_image = @explode('.', $image['name']);
    	unset( $ex_image[count($ex_image)-1] );
    	$image['name'] = @implode('.', $ex_image);
    	$image['name'] = preg_replace('#[\-_]+#Uis', ' ', $image['name']);
    also i have made some queries to modify name fields like

    Code:
    UPDATE `images` SET `name` = REPLACE(name, ' ', '')
    Last edited by xavior; 08-07-2011 at 07:30 PM.

  3. #3
    Join Date
    May 2005
    Location
    China & France
    Posts
    6,492

    Default

    It is better to modify the name without using mysql query:

    find the line in includes/core.func.php:
    PHP Code:
    $file[name] = (unhtmlspecialchars($file[name])); 
    after you can modify $file[name] using your methods:

    PHP Code:
    $ex_image = @explode('.'$file['name']);
        unset( 
    $ex_image[count($ex_image)-1] );
        
    $file['name'] = @implode('.'$ex_image);
        
    $file['name'] = preg_replace('#[\-_]+#Uis'' '$file['name']); 
    Then the name is changed without additional query.

Similar Threads

  1. Installation
    By smasher in forum Installation Support
    Replies: 1
    Last Post: 07-04-2011, 05:27 AM
  2. MYSQL query for creating table [dlsessions]!
    By yabsoft in forum Document & Tutorials!
    Replies: 1
    Last Post: 09-12-2008, 04:47 PM
  3. change the image Without change Linking Code
    By koreahosting in forum Modifications and Skin
    Replies: 0
    Last Post: 09-11-2007, 06:29 AM
  4. Please contact me ASAP :(
    By Luke in forum Troubleshooting And Problems
    Replies: 2
    Last Post: 11-27-2005, 06:48 AM
  5. Problem with installer on AIHS 2.0
    By papaman in forum Troubleshooting And Problems
    Replies: 1
    Last Post: 10-30-2005, 07:50 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •