Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5847025
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T12:39:36+00:00 2026-05-22T12:39:36+00:00

I have this $img[‘hash’] which is a long hash code 32-64 digits a09806aa003033128f44d5fd4c56786b (as

  • 0

I have this $img['hash'] which is a long hash code 32-64 digits a09806aa003033128f44d5fd4c56786b (as an example)
Is there any way in php to pull only the 1st two digits (a0)

<?php
$cdb = new PDO('mysql:dbname=xxx;host=localhost', 'xxx', 'xxx');

foreach ($cdb->query("SELECT * FROM images ORDER BY posted DESC LIMIT 9") AS $img)
{
    echo '<a style="position: relative; display: block; height: 200px;" href="/booru/post/view/' . $img['id'] . '" target="_blank">
          <img src="booru/timthumb.php?src=thumbs/' . $img['hash'] . '&h=125&w=125" style="border-style: none"/>
           </a> 
        ';
}

Sorry I should of added some more info I need to keep the $img[‘hash’] also

So like this

                <img src="booru/timthumb.php?src=thumbs/' . $img['hash'] . '/Here/&h=125&w=125" width="125px" style="border-style: none"/>

I need to add it where the “/here/” is

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T12:39:36+00:00Added an answer on May 22, 2026 at 12:39 pm

    You can use substr() to get a substring of a string, in this case your hash:

    $twofirst = substr($img['hash'], 0, 2);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code $imageMap=preg_replace('/([a-z ])/', '<img src=egypt/$1.png />', $input); Which works for a-z
When I have this code: $(img).each(function(i) { $(this).delay(i*100).fadeIn('slow'); }); Which can be seen live
I have this html: <img src=myimage.jpg id=idimg> Is there a way with javascript to
I have this peace of code which brings string searches for img tags in
I have this code to get all the img tag: <?php foreach($design_children as $design_child)
I have this HTML code multiple times one after the other: <li> <img src=path/to/my/picture.jpg
sorry, im new in jquery. I have this code on tag: <img class=fluidimage src=img/picture1.jpg/>
I have something like this: <img class=photo src=www.example.com /> <img class=photo src=www.example2.com /> <img
I have this jquery code: $(.button-banc).hover(function() { $(.button-banc img) .animate({ top: -21px }, 200).animate({
I have this jQuery code: <script type=text/javascript> $(function() { $(.one-edition img).hover(function() { $(this).next(.editions-info-text).show(); },

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.