Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Output Images

Posted on 2003-03-29
3
Medium Priority
?
346 Views
Last Modified: 2010-08-05
Greets,
I have an idea, but I need some help.

<?php
$GURL = "http://www.site.com/ShowPhoto.php?Type=1&ID=08";
$GURL2  = eregi_replace("08", "09", $GURL);
$GURL3  = eregi_replace("08", "10", $GURL);
$GURL4  = eregi_replace("08", "11", $GURL);
$GURL5  = eregi_replace("08", "12", $GURL);
$GURL6  = eregi_replace("08", "13", $GURL);
$GURL7  = eregi_replace("08", "14", $GURL);
$GURL8  = eregi_replace("08", "15", $GURL);
$GURL9  = eregi_replace("08", "16", $GURL);
$GURL10  = eregi_replace("08", "17", $GURL);
$GURL11  = eregi_replace("08", "18", $GURL);
$GURL12  = eregi_replace("08", "19", $GURL);
$GURL13  = eregi_replace("08", "20", $GURL);

               
echo "<img src='$GURL'><HR>";
echo "<img src='$GURL2'><HR>";
echo "<img src='$GURL3'><HR>";
echo "<img src='$GURL4'><HR>";
echo "<img src='$GURL5'><HR>";
echo "<img src='$GURL6'><HR>";
echo "<img src='$GURL7'><HR>";
echo "<img src='$GURL8'><HR>";
echo "<img src='$GURL9'><HR>";
echo "<img src='$GURL10'><HR>";
echo "<img src='$GURL11'><HR>";
echo "<img src='$GURL12'><HR>";
echo "<img src='$GURL13'><HR>";
echo "<img src='$GURL13'><HR>";
?>
 

I'm trying to output about 1500 images in a page.

Begins with:
?Type=1&ID=08

Ends with:
?Type=1&ID=1504 (or around there)

So, I need to learn how to make something which creates numbers 01-1600, and inserts each consecutively into a new echoed string, untill its complete.

Any help?
0
Comment
Question by:Passionate
3 Comments
 
LVL 4

Accepted Solution

by:
bljak earned 300 total points
ID: 8230475
Okay, you want code above auto generated
LOOPS are your friends ...

(int)$startImage = 8;
(int)$endImage = 1600;
$GURL = "http://www.site.com/ShowPhoto.php?Type=1&ID=";

for($a = $startImage;$a <= $endImage;$a++)
{
  echo "<img src=\"".$GURL.$a."\"><HR>";
}

thats all, though if you want it to have 08, 09, and above 10 it doesn't have 0 infront of it, use this for loop, variables stay same

for($a = $startImage;$a <= $endImage;$a++)
{
  if($a < 10)
  {
    //changes $a to string
    $currentA = "0".$a;
  } else {
    $currentA = $a;
  }
  //echoes url + current number to code
  echo "<img src=\"".$GURL.$currentA."\"><HR>";
}

hope this helped some
//bljak

0
 
LVL 15

Expert Comment

by:VGR
ID: 8230593
BTW, 1500 images on one HTML page (even 10KB/image only) is total madness ;-)
0
 

Author Comment

by:Passionate
ID: 8236240
Thank you.

Sorry it took so long for me to reply.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses

572 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question